Quote:
Originally posted by FaderMonkey
How do I go about using the PHP date() function? Where do I go from here?
|
The date() function requires a Unix time integer as its second argument, so it won't work with the MySQL timestamp. You'll need to use the MySQL UNIX_TIMESTAMP function in a query to get the timestamp into Unix format, as aoeuhtns suggests.
To answer your question - how to use the date() function: the first argument to date() is a string built up of the flags shown in the table on the manual page I linked you to. Example:
PHP Code:
<?php
$unix_time = mktime();
echo "The Unix representation of the current date and time is " . $unix_time ."<br>";
$human_time = date("F j, Y, g:i a", $unix_time);
echo $human_time;
?>
would print:
Code:
The Unix representation of the current date and time is 1089736421
July 13, 2004, 10:33 am