JonG Posted June 9, 2009 Share Posted June 9, 2009 Hey guys...am trying to log the date, but when I use this code the day shows as the 6th when today is the 9th? What am I doing wrong here???? <? //set correct time zone date_default_timezone_set("America/Edmonton"); $today = date("F m Y - h:i:sa"); echo $today; ?> Quote Link to comment https://forums.phpfreaks.com/topic/161567-solved-date-gives-wrong-date/ Share on other sites More sharing options...
Cosizzle Posted June 9, 2009 Share Posted June 9, 2009 My guess would be date_default_timezone_set("America/Edmonton"); read up here http://ca.php.net/date_default_timezone_set perhaps you have the wrong timezone? Quote Link to comment https://forums.phpfreaks.com/topic/161567-solved-date-gives-wrong-date/#findComment-852593 Share on other sites More sharing options...
taquitosensei Posted June 9, 2009 Share Posted June 9, 2009 m is month. So you're doing this for the format January 6 (6 is June) 2009 you probably want F jS Y - h:i:sa would give you June 6th 2009 15:09:00am Quote Link to comment https://forums.phpfreaks.com/topic/161567-solved-date-gives-wrong-date/#findComment-852594 Share on other sites More sharing options...
JonG Posted June 9, 2009 Author Share Posted June 9, 2009 lol thanks taq! What are the chances, I wrote this part on May 5th....everything seemed to work fine lol. I have the best luck.... Quote Link to comment https://forums.phpfreaks.com/topic/161567-solved-date-gives-wrong-date/#findComment-852601 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.