Page 1 of 1
date calculation
Posted: Fri Dec 05, 2008 1:18 am
by Hillu
Hi, I have events which last for 3 months. The recent event starts on Dec 2008 and ends on Mar 2009. I have the starting date in a combo box how do I calculate the ending date? Thanks
Re: date calculation
Posted: Fri Dec 05, 2008 1:29 am
by pbs
Can you please paste your combo box date values how you are using it.
Re: date calculation
Posted: Fri Dec 05, 2008 1:49 am
by Hillu
I have the following declarations in another file which I included in the file in question:
$currentdate = getdate();
$currentyear=$currentdate['year'];
$currentmon=$currentdate['mon']; // month in number
$currentday=$currentdate['mday'];
I also have a 'DateDropDown' function which lists dates by concatenating the year, months and date.
After the include statment I I wrote:
$DateSelected = sprintf("%04d-%02d-%02d", $currentyear, $currentmon, $currentday);
And finally the combo box.
<select class="button" name="cbo_starting_date" id="cbo_starting_date" >
<?php DateDropDown($DateSelected ,40,1,10); ?>
</select>
Thanks
Re: date calculation
Posted: Fri Dec 05, 2008 2:33 am
by pbs
Try to use time() and mktime() functions, which will be easy.