php - Want to add dates for week -


I am using this code in the code in one week :

  $ date1 = "2009-10-11"; $ D = new date time ($ 1 date); $ D- & gt; Modify ('+1 week'); Echo $ d- & gt; Format ('YMD'), "\ n";   

It works well, but this functionality is to be added:

  $ startDate = "2009-10-11"; $ EndDate = "2010-01-20";   

and want to create an array holding all +1 weeks between these dates. How can I do this?

Here's a way to do this:

  $ startDate = "2009-10-11"; $ EndDate = "2010-01-20"; $ Dates = array (); $ Temp = strtotime ($ startDate); Do {$ dates [] = Date ("Y-M-D", $ temp); $ Temp = strtotime ("+ 1 week", $ temp); } While ($ temp & lt; strtotime ($ endDate)); Print_r ($ DAYS);   

You can view

Comments

Popular posts from this blog

c# - passing input text from view to contoller with FacebookContext using Facebook app -

ios - Does Core Data autoupdate a many to many relationship on saving -

Calling a C++ function from C# by passing a string with variable size to it -