limitphp Posted May 11, 2009 Share Posted May 11, 2009 I have a column datetime called date. Here's the value of an entry for the datetime: 2009-05-10 06:06:55 here's the code: $date = $row_inbox['date']; $date = date('D, M d, Y g', $date); its returning: Wed, Dec 31, 1969 6 I want it to return short day, short month day, year time Does anyone know what I am doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/ Share on other sites More sharing options...
wildteen88 Posted May 11, 2009 Share Posted May 11, 2009 the second parameter requires a UNIX timestamp. Use strtotime to convert $date to unix timestamp Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/#findComment-831740 Share on other sites More sharing options...
limitphp Posted May 11, 2009 Author Share Posted May 11, 2009 ok, its working now.... but its saying Sat. may 10.....instead of Sunday may 10th.... Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/#findComment-831742 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 man date Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/#findComment-831746 Share on other sites More sharing options...
limitphp Posted May 11, 2009 Author Share Posted May 11, 2009 man date I'm sorry....what I mean is, its giving me the wrong day. Its saying Sat. instead of Sun. Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/#findComment-831748 Share on other sites More sharing options...
Ken2k7 Posted May 11, 2009 Share Posted May 11, 2009 That's server time, the time your server is in, not your local time. Though I guess you can use setlocale to adjust. Quote Link to comment https://forums.phpfreaks.com/topic/157710-solved-help-with-date-format/#findComment-831753 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.