functions-online

Date and Time

Execute and test PHP functions for date and time manipulation.

date

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given. In other words, $timestamp is optional and defaults to the value of time().

idate

Returns a number formatted according to the given $format string using the given integer $timestamp or the current local time if no $timestamp is given. In other words, $timestamp is optional and defaults to the value of time().

Unlike the function date(), idate() accepts just one char in the $format parameter.

jdtounix

This function will return a Unix timestamp corresponding to the Julian Day given in $jday or FALSE if $jday is not inside the Unix epoch (Gregorian years between 1970 and 2037 or 2440588 <= $jday <= 2465342). The time returned is localtime (and not GMT).

jewishtojd

Although this function can handle dates all the way back to the year 1 (3761 B.C.), such use may not be meaningful. The Jewish calendar has been in use for several thousand years, but in the early days there was no formula to determine the start of a month. A new month was started when the new moon was first observed.

mktime

Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.

Arguments may be left out in order from right to left; any arguments thus omitted will be set to the current value according to the local date and time.

strftime

Returns a string formatted according to the given $format string using the given $timestamp or the current local time if no timestamp is given. Month and weekday names and other language dependent strings respect the current locale set with setlocale().

Not all conversion specifiers may be supported by your C library, in which case they will not be supported by PHP's strftime(). Additionally, not all platforms support negative timestamps, therefore your date range may be limited to no earlier than the Unix epoch. This means that e.g. %e, %T, %R and %D (there might be more) and dates prior to Jan 1, 1970 will not work on Windows, some Linux distributions, and a few other operating systems.

strptime

strptime() returns an array with the $date parsed, or FALSE on error.

Month and weekday names and other language dependent strings respect the current locale set with setlocale().

strtotime

The function expects to be given a string containing a US English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 GMT), relative to the timestamp given in $now, or the current time if $now is not supplied.

unixtojd

Return the Julian Day for a Unix $timestamp (seconds since 1.1.1970), or for the current day if no $timestamp is given.