Gruzin Posted July 5, 2007 Share Posted July 5, 2007 Hey guys, Just could not figure out... I'am having some dates with following formatting: 2007-6-5 2007-6-18 how can I manipulate this string to get this: 2007-06-05 2007-06-18 thanks and I'am glad that I'am still here George Quote Link to comment https://forums.phpfreaks.com/topic/58568-very-simple-question-about-mktime/ Share on other sites More sharing options...
soycharliente Posted July 5, 2007 Share Posted July 5, 2007 You want to return 2007-6-8 in the format 2007-06-08 for output? Look at http://us.php.net/date. Quote Link to comment https://forums.phpfreaks.com/topic/58568-very-simple-question-about-mktime/#findComment-290524 Share on other sites More sharing options...
Gruzin Posted July 5, 2007 Author Share Posted July 5, 2007 You want to return 2007-6-8 in the format 2007-06-08 for output? Look at http://us.php.net/date. No, I already have the string like this: 2007-6-8 and I want it to be like: 2007-06-08 Thanks, George Quote Link to comment https://forums.phpfreaks.com/topic/58568-very-simple-question-about-mktime/#findComment-290546 Share on other sites More sharing options...
soycharliente Posted July 5, 2007 Share Posted July 5, 2007 I was trying to get you to look at the function you wanted yourself. BUT... <?php $thedate = "2007-6-8"; $ymd = explode("-", $thedate); echo date("Y-m-d", mktime(0, 0, 0, $ymd[1], $ymd[2], $ymd[0])); ?> Quote Link to comment https://forums.phpfreaks.com/topic/58568-very-simple-question-about-mktime/#findComment-290564 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.