Saturday, January 31, 2009

Date and Time Functions

checkdate --> Checks whether date is valid. Returns TRUE or FALSE.
Format: checkdate(month,day,year);
date, gmdate
Converts a Unix timestamp into a formatted date. The function gmdate returns Greenwich Mean Time. Format: $formatted_date = date(“format”,$timestamp);
getdate
Creates an array from a Unix timestamp, each element containing part of the array, such as seconds, minutes, month, day of the year, and so on.
Format: $array_date = getdate($timestamp);
localtime
Creates an array of values related to your local time, such as seconds, minutes, day of month, and so on.
Format: $array_date = localtime($timestamp);
Microtime --> Returns time in seconds and microseconds since January 1, 1970.
Format: $time_out = microtime();
mktime, gmmktime --> Returns a Unix timestamp. gmmktime uses Greenwich Mean Time.
Format: $timestamp=mktime(“hrs”,”min”,”sec”,”mo”,”da”,”yr”);
time --> Returns the Unix timestamp for the current time.
Format: $timestamp = time();

No comments:

Post a Comment