All the time functions work off the UNIX epoch, which is January 1, 1970. Dates are expressed as seconds since the epoch. This makes it easy to refer to dates with integers. When a function calls for seconds since the epoch, I've referred to it as a timestamp.
boolean checkdate(integer month, integer day, integer year)
The checkdate function returns TRUE if a date is valid, FALSE otherwise. A day is considered valid if the year is between 0 and 32,767, the month is between 1 and 12, and lastly, if the day is within the allowable days for that month.
string date(string format, integer timestamp)
The date function returns a string describing the date of the timestamp according to the format argument. Letters in the format argument are replaced with parts of the date or time. Any characters not understood as codes are passed along in place.The timestamp argument is optional. If left out, the current time will be used. The timestamp is interpreted as being in local time.
array getdate(integer timestamp)
The getdate function returns an associative array with information about the given date. The timestamp argument is the number of seconds since January 1, 1970. If left out, the current time is used.
The gettimeofday function returns an associative array containing information about the current time. This is a direct interface to the C function of the same name.
string gmdate(string format, integer timestamp)
The gmdate function operates identically to the date function except that, rather than return the time for the local time zone, Greenwich Mean Time is returned.<?
string gmstrftime(string format, integer timestamp)
The gmstrftime function operates identically to strftime except that the timestamp is translated into Greenwich Mean Time. The same format codes defined are used in the format argument.<?
The microtime function returns a string with two numbers separated by a space. The first number is microseconds on the system clock. The second is the number of seconds since January 1, 1970.
integer mktime(integer hour, integer minute, integer second,integer month, integer day, integer year)
The mktime function returns a timestamp for a given date, the number of seconds since January 1, 1970. All the arguments are optional and, if left out, the appropriate value for the current time will be used. If an argument is out of range, mktime will account for the surplus or deficit by modifying the other time units. For example, using 13 for the month argument is equivalent to January of the following year. This makes mktime an effective tool for adding arbitrary time to a date.
string strftime(string format, integer timestamp)
The strftime function returns a date in a particular format. If the optional timestamp argument is left out, the current time will be used. Language-dependent strings will be set according to the current locale, which may be changed with the setlocale function. The format string may contain codes that have special meaning and begin with a percentage sign. Other characters are passed through unchanged.<?
integer strtotime(string date, integer now)
The strtotime function attempts to parse a string containing date and time, returning the timestamp for it. If partial information is provided in the date argument, the missing information will be drawn from the now argument. You may leave out the now argument to use the current time.<?
Use time to get the current timestamp.
PHP Related Interview Questions
|PHP Interview Questions||MySQL Interview Questions|
|PHP+MySQL Interview Questions||Drupal Interview Questions|
|MYSQL DBA Interview Questions||PHP5 Interview Questions|
|WordPress Interview Questions||Joomla Interview Questions|
|CakePHP Interview Questions||CodeIgniter Interview Questions|
|PHP7 Interview Questions|
An Introduction To Php
Variables, Operators, And Expressions
Classes And Objects
I/o And Disk Access
Time, Date, And Configuration Functions
Parsing And String Evaluation
Sorting Searching And Random Numbers
Integration With Html
Efficiency And Debugging
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.