robert_gsfame Posted January 15, 2010 Share Posted January 15, 2010 How to convert January 10, 2010 into 10-10-2010 using date() ?? Thxx Quote 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); ?> Quote 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')); Quote 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!! Quote 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 Quote 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 Quote 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! Quote Link to comment https://forums.phpfreaks.com/topic/188524-convert-format-time/#findComment-995295 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.