Page 1 of 1
[SOLVED]date and time question
Posted: Wed Jun 23, 2004 3:12 pm
by Calimero
I need php to give me date or even time (current),
I tried TIME(), but got something very strange

as output.
So, please code to get current date and if possible time.
Thanks Ahead!
Posted: Wed Jun 23, 2004 3:15 pm
by markl999
http://php.net/time returns a unix timestamp, you can then pass this unix timestamp into
http://php.net/date
(date on it's own without a time passed in uses the current time)
See
http://php.net/date for the display/format options
Posted: Wed Jun 23, 2004 5:57 pm
by PrObLeM
THis will echo out the current time in this format
06-23-2004 at 3:57 pm
Code: Select all
echo date('m-d-Y \a\t h:i a' ,time());
Posted: Wed Jun 23, 2004 6:00 pm
by tim
if u want the time for a specific timezone, i found this bit most easy to configure to your wantings =]
$time = date('g:i:A', strtotime("-0 hours"));