Help to add 1 year to this code

Hi,

I need a little help modifying a small bit of code, but i’m not too hot and coding :-[

it basically displays at date in the database, but i now need it to add 12 months onto this date. Any ideas how this can easily be done?

[php]$dateTemp = explode(’-’,$bookingData[‘bdate’]);
$bookingDate = mktime(12,0,0,$dateTemp[1],$dateTemp[2],$dateTemp[0]);[/php]

Many Thanks

Very little code to understand what you want but you can try this the I am using date 30-08-2012 this is for europe.

[php]$dateTemp[‘0’] = $dateTemp[‘0’]+1; // ??? 0 1 or 2 for the year guessing 0 for time stamp but array might be different.
$bookingDate = mktime(12,0,0,$dateTemp[‘1’],$dateTemp[‘2’],$dateTemp[‘0’]); [/php]

or you can use this which is easier and shorter as your date format is 2012-08-30
[php]$bookingDate = mktime(12,0,0,$dateTemp[‘1’],$dateTemp[‘2’],$dateTemp[‘0’]++); [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service