adding days to date for new date with correct month stamp
Posted: Fri Jan 07, 2011 4:26 pm
I currently have this working to post the correct format:
the hour format is 00 -23
the day format is 0-31
month format is from 01-12
code:
$aud1hour = "09";
$aud1day = "20";
$aud1month = "10";
$stamp = mktime($aud1hour,0,0,$aud1month,$aud1day,0);
$formatted_date = date('g:ia, M jS',$stamp);
echo "<font face='geneva, arial, sans serif' size='2' color='#00FF00'>".$formatted_date."</font>";
//THIS WILL PRINT THE CORRECT FORMAT OF
9:00am, Oct 20th
**now here is what I need done, I need to figure out a way that if I add 12 days to $aud1day making it the number 32 What function / code can I use to convert the month to 11 and set the day to 1, or if the month is a 30 day month, or 28 or 29 ( leap year ) instead of using an insane amount of if statements.
the hour format is 00 -23
the day format is 0-31
month format is from 01-12
code:
$aud1hour = "09";
$aud1day = "20";
$aud1month = "10";
$stamp = mktime($aud1hour,0,0,$aud1month,$aud1day,0);
$formatted_date = date('g:ia, M jS',$stamp);
echo "<font face='geneva, arial, sans serif' size='2' color='#00FF00'>".$formatted_date."</font>";
//THIS WILL PRINT THE CORRECT FORMAT OF
9:00am, Oct 20th
**now here is what I need done, I need to figure out a way that if I add 12 days to $aud1day making it the number 32 What function / code can I use to convert the month to 11 and set the day to 1, or if the month is a 30 day month, or 28 or 29 ( leap year ) instead of using an insane amount of if statements.