ukscotth Posted December 1, 2008 Share Posted December 1, 2008 Hi, I think this should be pretty easy for someone who knows how. I have a date and time stored in a database field and when i do a simple echo it shows up like this : 1224950428 Is there an easy way i can make it display something like this instead : 23 March, 8:45pm Many thanks in advance. Scott. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 1, 2008 Share Posted December 1, 2008 Yes use the date function Quote Link to comment Share on other sites More sharing options...
ukscotth Posted December 1, 2008 Author Share Posted December 1, 2008 tried that but not sure where to put the actual variable where the date is stored. Would it be something like this ? <?php echo date ($topic['topic_last_post']); ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted December 1, 2008 Share Posted December 1, 2008 $last_post_date = date("F j, Y, g:i a", $topic['topic_last_post'])); echo $last_post_date Quote Link to comment Share on other sites More sharing options...
ukscotth Posted December 1, 2008 Author Share Posted December 1, 2008 sorted. Thanks alot for ur help, ur a star most appreciated. Quote Link to comment Share on other sites More sharing options...
DjMikeWatt Posted May 3, 2009 Share Posted May 3, 2009 Would this be the same as: <?php $event_date = date("F j, Y", ($row_rs_user['event_date'])); echo $event_date ; ?> I ask because when I use the above code, the date displays as "December 31, 1969" even though the DB data is "2009-10-21"... Obviously, I am expecting the page to echo "October 21, 2009", but this is not what I'm getting... Any thoughts on what I've done wrong? Quote Link to comment Share on other sites More sharing options...
trq Posted May 3, 2009 Share Posted May 3, 2009 date expects a unix timestamp. You'll need to convert your string to one if you expect it to work. <?php $event_date = date("F j, Y", strtotime($row_rs_user['event_date'])); echo $event_date; ?> Quote Link to comment 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.