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
Date YYYY-MM-DD
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Date YYYY-MM-DD
What's your question?
Re: Date YYYY-MM-DD
Thanks for telling us!
Re: Date YYYY-MM-DD
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
so how do i convert it to 03 n then deliver it to the DB
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Date YYYY-MM-DD
Check out the PHP manual. Type "PHP date" into Google.
Re: Date YYYY-MM-DD
Code: Select all
<?php
$isodate = sprintf("%04d-%02d-%02d", $year, $month, $day);
?>
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: Date YYYY-MM-DD
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"