FUNCTION NAME |
FUNCTION DESCRIPTION |
FUNCTION SYNTAX |
FUNCTION RETURN VALUE |
microtime()
[Return current Unix timestamp with microseconds] |
Returns the current Unix timestamp with microseconds. This function only works on operating systems that support the gettimeofday() system call. |
microtime(get_as_float [optional parameter, with a default value of false]); |
If get_as_float is false [default] then a string is returned in the form ‘msec sec‘, where sec is the number of seconds since the Unix Epoch and msec measures microseconds that have elapsed since sec. If get_as_float is true then a float is returned that represents the number of seconds since the Unix Epoch, accurate to the nearest microsecond. |
mktime()
[Get Unix timestamp for a date] |
Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer and represents the number of seconds between the Unix Epoch and the time specified. |
mktime(hour, minute, second, month, day, year, is_dst);
[All the above parameters are optional. Default values: hour = date("H") ; minute = date("i") ; second = date("s") ; month = date("n") ; day = date("j") ; year = date("Y") ; and is_dst = -1 [signifying that it is unknown if Daylight Savings Time is in operation; this parameter became deprecated in PHP 5.1.0 and has been removed from PHP 7.0.0+].] |
mktime() : returns the Unix timestamp of the arguments given. If invalid arguments are given, FALSE is returned. |
strftime()
[Format a local time/date according to locale settings] |
Formats the time and/or date according to locale settings, based on format_string. Month, weekday names, and other language-dependent strings respect the current locale set with setlocale() . Conversion specifiers that are not supported by your C library will not be supported by strftime() . Furthermore, platforms that do not support negative timestamps will be limited to a date range that starts no earlier than the Unix Epoch. |
strftime(format_string, timestamp [optional parameter, with a default value of time() ]);
[The maximum length of format_string is 1023 characters. Valid characters for this parameter are: %a [‘Sun’ — ‘Sat’]; %A [‘Sunday’ — ‘Saturday’]; %d [’01’ — ’31’]; %e [‘1′ — ’31’]; %j [‘001’ — ‘366’]; %u [‘1’ (Monday) — ‘7’ (Sunday)]; %w [‘0’ (Sunday) — ‘6’ (Saturday)]; %U [week number of year; Sunday as first day of the week]; %V [week number of year; Monday as start of week; first week has 4+ weekdays]; %W [numerical representation of the week of the year, starting with the first Monday as the first week]; %b [‘Jan’ — ‘Dec’]; %B [‘January’ — ‘December’]; %h [‘Jan’ — ‘Dec’; alias of %b]; %m [’01’ (January) — ’12’ (December)]; %C [2-digit representation of the century]; %g [2-digit representation of the year, according to ISO-8601:1988]; %G [4-digit representation of %g]; %y [2-digit representation of year]; %Y [4-digit representation of year]; %H [’00’ — ’23’]; %k [‘0′ — ’23’]; %I [’01’ — ’12’]; %l [‘1′ — ’12’]; %M [’00’ — ’59’]; %p [‘AM’ or ‘PM’]; %P [‘am’ or ‘pm’]; %r [same as %I:%M:%S %p ]; %R [same as %H:%M ]; %S [seconds – ’00’ — ’59’]; %T [same as %H:%M:%S ]; %X [preferred time representation based on locale, without the date]; %z [timezone offset – ‘-0500’]; %Z [timezone abbreviation – ‘EST’]; %c [preferred date and timestamp based on locale]; %D [same as %m/%d/%y ]; %F [same as %Y-%m-%d ]; %s [Unix Epoch timestamp]; %x [preferred date representation based on locale, without the time]; %n [newline character]; %t [tab character]; and %% [a literal ‘%’].] |
Returns a string formatted according to format_string, using the given timestamp or the current local time if this parameter is not provided. Supplying unknown conversion specifiers on a Windows system results in 5 E_WARNING messages and a return value of FALSE. Other operating systems might not issue any E_WARNING messages and may output the specifiers unconverted. |
strptime()
[Parse a time/date generated with strftime() ] |
Returns an array with the date parsed. Month names, weekday names, and other language-dependent strings respect the current locale set with setlocale() [LC_TIME]. Internally, this function calls the strptime() function provided by the system’s C library, and does not produce consistent output across different operating systems; it is not even implemented on Windows platforms. The use of date_parse_from_format() is recommended from PHP 5.3.0+. |
strptime(date, format);
[date represents the string to parse (eg. returned from strftime() ); format represents the format used in date (eg. the same as used in strftime() ). The exact subset of supported formatting options will vary based on the operating system and C library in use.] |
Returns an array on success, or FALSE on failure. The following elements are returned in the array: tm_sec [seconds after the minute — 0-61]; tm_min [minutes after the hour — 0-59]; tm_hour [hours since midnight — 0-23]; tm_mday [day of the month — 1-31]; tm_mon [months since January — 0-11]; tm_year [years since 1900]; tm_wday [days since Sunday — 0-6]; tm_yday [days since January 01 — 0-365]; and unparsed [the date part that was not recognized using the specified format]. |
strtotime()
[Parse about any English textual datetime description into a Unix timestamp] |
This function tries to parse the provided time string into a Unix timestamp, relative to the now timestamp or the current local time if now is not provided. Each parameter uses the default timezone unless a particular timezone is specified in that parameter. |
strtotime(time, now [optional parameter, with a default value of time() ]); |
strtotime() : returns a timestamp on success, or FALSE on failure. Prior to PHP 5.1.0 this function would return -1 on failure. |
time()
[Return current Unix timestamp] |
Returns the time in the form of the number of seconds since the Unix Epoch. Since PHP 5.1 the timestamp of the start of the request is available in $_SERVER['REQUEST_TIME'] . |
time(); |
time() : returns the number of seconds since the Unix Epoch. |
DateTimeZone::listAbbreviations()
timezone_abbreviations_list()
[Returns associative array containing dst, offset and the timezone name] |
This function returns an associative array containing dst, offset, and the timezone name. |
Object-oriented:
DateTimeZone::listAbbreviations();
Procedural style:
timezone_abbreviations_list(); |
Returns an associative array containing dst, offset, and the timezone name on success; FALSE on failure. |
DateTimeZone::listIdentifiers()
timezone_identifiers_list()
[Returns a numerically-indexed array containing all defined timezone identifiers] |
This function returns a numerically-indexed array containing all defined timezone identifiers. |
Object-oriented:
DateTimeZone::listIdentifiers(DateTimeZone_Constant [optional parameter, defaulting to DateTimeZone::ALL ], country [optional parameter, defaulting to NULL ]);
[country is only used when DateTimeZone::PER_COUNTRY is set as the DateTimeZone_Constant parameter. country represents a two-letter ISO 3166-1 compatible country code.] |
DateTimeZone::listIdentifiers() : returns a numerically-indexed array containing all defined timezone identifiers on success; FALSE on failure. |