Page 1 of 1
Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 7:32 am
by hmvrulz
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
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 7:40 am
by aceconcepts
What's your question?
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 7:51 am
by papa
Thanks for telling us!
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 7:51 am
by hmvrulz
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
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 7:53 am
by aceconcepts
Check out the PHP manual. Type "PHP date" into Google.
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 8:31 am
by hmvrulz
Code: Select all
<?php
$isodate = sprintf("%04d-%02d-%02d", $year, $month, $day);
?>
tht works
Re: Date YYYY-MM-DD
Posted: Wed Oct 08, 2008 8:58 am
by aceconcepts
I was thinking of something more along the lines of:
Code: Select all
$date_for_db=date("Y-m-d", strtotime($your_date));
//$date_for_db should output as "YYYY-MM-DD"