hmvrulz Posted October 8, 2008 Share Posted October 8, 2008 I created a forum for entering birthday using php. So i get day n month as 1,2,3,4,.... and not with the leading 'ZERO' Am storing the DATE as YYYY-MM-DD Link to comment https://forums.phpfreaks.com/topic/127535-date-yyyy-mm-dd/ Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 What's your question? Link to comment https://forums.phpfreaks.com/topic/127535-date-yyyy-mm-dd/#findComment-659827 Share on other sites More sharing options...
hmvrulz Posted October 8, 2008 Author Share Posted October 8, 2008 What's your question? for selecting date i use drop down menus.. for creating that i use php... so the value of March wil be 3 and not 03... so how do i convert it to 03 n then deliver it to the DB Link to comment https://forums.phpfreaks.com/topic/127535-date-yyyy-mm-dd/#findComment-659843 Share on other sites More sharing options...
waynew Posted October 8, 2008 Share Posted October 8, 2008 As far as I know, if it's 3, MySQL will still accept it. Otherwise use: $date = ("Y-m-d"); http://us.php.net/date Link to comment https://forums.phpfreaks.com/topic/127535-date-yyyy-mm-dd/#findComment-659847 Share on other sites More sharing options...
hmvrulz Posted October 8, 2008 Author Share Posted October 8, 2008 <?php $isodate = sprintf("%04d-%02d-%02d", $year, $month, $day); ?> tht works Link to comment https://forums.phpfreaks.com/topic/127535-date-yyyy-mm-dd/#findComment-659873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.