ShaolinF Posted November 26, 2009 Share Posted November 26, 2009 Hi Guys I am trying to format a timestamp from the DB using the date function but it keeps returning 1/1/1970. $date_posted = 2009-11-25 22:14:25 date( "d/m/Y", $date_posted); // = 01/01/1970 Link to comment https://forums.phpfreaks.com/topic/182970-formatting-date/ Share on other sites More sharing options...
Goldeneye Posted November 26, 2009 Share Posted November 26, 2009 date only accepts Unix-Timestamps. You have to pass your date through strtotime -- like so: <?php $date_posted = 2009-11-25 22:14:25 $date_posted = strtotime($date_posted); date( "d/m/Y", $date_posted); ?> Link to comment https://forums.phpfreaks.com/topic/182970-formatting-date/#findComment-965743 Share on other sites More sharing options...
ShaolinF Posted November 26, 2009 Author Share Posted November 26, 2009 Thanks Link to comment https://forums.phpfreaks.com/topic/182970-formatting-date/#findComment-965747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.