Quick Search:
 
 PHP Code: UNIX Timestamp conversion Jump to:  
Category: >> PHP Code >> UNIX Timestamp conversion  

<< lastnext >>

Snippet Name: UNIX Timestamp conversion

Description: Examples of converting UNIX timestamps to more useful formats.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 28th, 2009

<?PHP
 
// produces a timestamp that looks like "YYYY-MM-DD 24:00:00":
$formated_datetime = DATE("Y-m-d H:i:s");
 
// takes $formated_datetime and converts to "UNIX timestamp":
$unix_timestamp = STRTOTIME($formated_datetime);
 
// converts $unix_timestamp to "normal" formated_datetime:         
$formated_datetime = DATE("Y-m-d H:i:s",$unix_timestamp);   
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org