PHP Date and Time Functions

EditRocket provides the following information on Date and Time functions in the PHP source code builder.

bool checkdate ( int $month , int $day , int $year ) - Checks the validity of the date formed by the arguments. A date is considered valid if each parameter is properly defined.

string date ( string $format [, int $timestamp ] ) - Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.

DateTime date_create ([ string $time [, DateTimeZone $timezone ]] ) -

void date_date_set ( DateTime $object , int $year , int $month , int $day ) -

string date_default_timezone_get ( void ) - This functions returns the default timezone.

bool date_default_timezone_set ( string $timezone_identifier ) - date_default_timezone_set() sets the default timezone used by all date/time functions.

string date_format ( DateTime $object , string $format ) -

void date_isodate_set ( DateTime $object , int $year , int $week [, int $day ] ) -

void date_modify ( DateTime $object , string $modify ) -

int date_offset_get ( DateTime $object ) -

array date_parse ( string $date ) -

array date_sun_info ( int $time , float $latitude , float $longitude ) -

mixed date_sunrise ( int $timestamp [, int $format [, float $latitude [, float $longitude [, float $zenith [, float $gmt_offset ]]]]] ) - date_sunrise() returns the sunrise time for a given day (specified as a timestamp) and location.

mixed date_sunset ( int $timestamp [, int $format [, float $latitude [, float $longitude [, float $zenith [, float $gmt_offset ]]]]] ) - date_sunset() returns the sunset time for a given day (specified as a timestamp) and location.

void date_time_set ( DateTime $object , int $hour , int $minute [, int $second ] ) -

DateTimeZone date_timezone_get ( DateTime $object ) -

void date_timezone_set ( DateTime $object , DateTimeZone $timezone ) -

array getdate ([ int $timestamp ] ) -

mixed gettimeofday ([ bool $return_float ] ) - This is an interface to gettimeofday(2). It returns an associative array containing the data returned from the system call.

string gmdate ( string $format [, int $timestamp ] ) -

int gmmktime ([ int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst ]]]]]]] ) -

string gmstrftime ( string $format [, int $timestamp ] ) -

int idate ( string $format [, int $timestamp ] ) - 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.

array localtime ([ int $timestamp [, bool $is_associative ]] ) - The localtime() function returns an array identical to that of the structure returned by the C function call.

mixed microtime ([ bool $get_as_float ] ) - microtime() returns the current Unix timestamp with microseconds. This function is only available on operating systems that support the gettimeofday() system call.

int mktime ([ int $hour [, int $minute [, int $second [, int $month [, int $day [, int $year [, int $is_dst ]]]]]]] ) - 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.

string strftime ( string $format [, int $timestamp ] ) - Returns a string formatted according to the given format string using the given timestamp or the current local time if no timestamp is given.

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

int strtotime ( string $time [, int $now ] ) - This function will use the TZ environment variable (if available) to calculate the timestamp. Since PHP 5.1.0 there are easier ways to define the timezone that is used across all date/time functions.

int time ( void ) - Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

array timezone_abbreviations_list ( void ) -

array timezone_identifiers_list ( void ) -

string timezone_name_from_abbr ( string $abbr [, int $gmtOffset [, int $isdst ]] ) -

string timezone_name_get ( DateTimeZone $object ) -

int timezone_offset_get ( DateTimeZone $object , DateTime $datetime ) -

DateTimeZone timezone_open ( string $timezone ) -

array timezone_transitions_get ( DateTimeZone $object ) -