LMPX.COM |
Home | Linux | Mysql | PHP | XML | ||
|
|
|||
From: Owen Date: Sat Jan 19 00:58:44 2008 Subject: Re: Looping Dates.
> I am stuck here, I want to get list of dates in a certain range. Like: > Start Date: 2007-01-03 to End Date: 2007-05-30 > > I am pointless here as what should I do in order to get all dates between > start and end? Is there any for, foreach loop or other method? that will > generate a list of dates: > > 2007-01-03 > 2007-01-04 > 2007-01-05 > 2007-01-06 > 2007-01-07 > .............. and so on to > 2007-05-30 > > Any ideas will be appreciated. If you have Date::Simple, this should start you off ========================================== #!/usr/bin/perl use Date::Simple (':all'); use strict; my $date = Date::Simple->new('1972-01-27'); print "$date\n"; for (my $i=1; $i <=10; $i++){ my $date = $date + $i; print "$date\n"; }
| Navigate in group perl.beginners.cgi at sever nntp.perl.org | |
| Previous | Next |
| © No Copyright You are free to use Anything |
Site Maintained by PHP Developer
Powered By PHP Consultants |