Faqts : Business : Programming : Shopping For You : PHP : Function Libraries : Date and Time

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 8 people (63%) answered Yes
Recently 5 of 8 people (63%) answered Yes

Entry

How can I perpetually calculate a range of dates?

Aug 6th, 2002 09:34
Jay Gustafson, http://www.php.net/manual/en/function.mktime.php; Dante Lorenso


$thismonth = date("n");
   $today = date("j");
   $thisyear = date("Y");
   $daysintofuture = 14;
   $daysinwindow = 28;
   $uc_startday = strftime("%d",mktime
(0,0,0,$thismonth,$today+$daysintofuture,$thisyear));
   $uc_startmonth = strftime("%m",mktime
(0,0,0,$thismonth,$today+$daysintofuture,$thisyear));
   $uc_startyear = strftime("%Y",mktime
(0,0,0,$thismonth,$today+$daysintofuture,$thisyear));
   $uc_start_date = $uc_startyear.$uc_startmonth.$uc_startday;
   $uc_endday = strftime("%d",mktime
(0,0,0,$uc_startmonth,$uc_startday+$daysinwindow,$uc_startyear));
   $uc_endmonth = strftime("%m",mktime
(0,0,0,$uc_startmonth,$uc_startday+$daysinwindow,$uc_startyear));
   $uc_endyear = strftime("%Y",mktime
(0,0,0,$uc_startmonth,$uc_startday+$daysinwindow,$uc_startyear));
   $uc_end_date = $uc_endyear.$uc_endmonth.$uc_endday;