Asheeown Posted February 21, 2007 Share Posted February 21, 2007 I need this date string: Day Month Date Hour:Minute:Seconds Year Wed Feb 21 22:22:37 2007 To this: yyyy-mm-dd hh:mm:ss 2007-02-21 22:22:37 Link to comment https://forums.phpfreaks.com/topic/39552-solved-change-date-and-time/ Share on other sites More sharing options...
paul2463 Posted February 21, 2007 Share Posted February 21, 2007 try this <?php $Str = strtotime("Wed Feb 21 22:22:37 2007"); $date = date("Y-m-d h:i:s", $Str); echo "Date = $date"; // output = Date = 2007-02-21 10:22:37 ?> edit: Capital H would give the hour in 24 hour format Link to comment https://forums.phpfreaks.com/topic/39552-solved-change-date-and-time/#findComment-190848 Share on other sites More sharing options...
matty Posted February 21, 2007 Share Posted February 21, 2007 http://us3.php.net/strftime Link to comment https://forums.phpfreaks.com/topic/39552-solved-change-date-and-time/#findComment-190850 Share on other sites More sharing options...
Asheeown Posted February 21, 2007 Author Share Posted February 21, 2007 Perfect, thanks much Link to comment https://forums.phpfreaks.com/topic/39552-solved-change-date-and-time/#findComment-190851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.