robert_gsfame Posted January 15, 2010 Share Posted January 15, 2010 How to convert January 10, 2010 into 10-10-2010 using date() ?? Thxx Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/ Share on other sites More sharing options...
premiso Posted January 15, 2010 Share Posted January 15, 2010 strtotime would be the key: <?php $time = strtotime("January 10, 2010"); echo date('m-d-Y', $time); ?> Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995281 Share on other sites More sharing options...
JAY6390 Posted January 15, 2010 Share Posted January 15, 2010 echo date('m-d-Y', strtotime('January 10, 2010')); Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995282 Share on other sites More sharing options...
robert_gsfame Posted January 15, 2010 Author Share Posted January 15, 2010 Oops forgot that function Thanks guys!! Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995283 Share on other sites More sharing options...
robert_gsfame Posted January 15, 2010 Author Share Posted January 15, 2010 One more question, What is the format time default?? "m-d-y" or "d-m-y"?? I wish to sort it based on time in mysql Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995288 Share on other sites More sharing options...
JAY6390 Posted January 15, 2010 Share Posted January 15, 2010 In MySQL it's Y-m-d I think Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995291 Share on other sites More sharing options...
robert_gsfame Posted January 15, 2010 Author Share Posted January 15, 2010 Thx everyone! Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.