On Tue, 15 Jul 2003, steve silvers wrote:

> Quick question. I need my script to generate two weeks worth of dates and
> days starting with the Saturdays.
>
> So on Friday 07/04/2003 my script would generate the below for the next two
> weeks, and so on..
>
> 07/05/2003    Saturday
> 07/06/2003    Sunday
> 07/07/2003    Monday
> 07/08/2003    Tuesday
> 07/09/2003    Wednesday
> 07/10/2003    Thursday
> 07/11/2003    Friday
>
> 07/12/2003    Saturday
> 07/13/2003    Sunday
> 07/14/2003    Monday
> 07/15/2003    Tuesday
> 07/16/2003    Wednesday
> 07/17/2003    Thursday
> 07/18/2003    Friday
>
>
> Any suggestions on how to implement this?

Localtime or gmtime would work. Once you have the timestamp of the
first Saturday, you can just increment the timestamp by an ammount,
in seconds for a daya, i.e. $saturday+=24*3600; Just "feed" the
adjusted timestamp as a parameter to localtime and get the values
of month, day and year. Do this loop 14 times and you have your 2 weeks
of dates. If you always run this program on Friday then you can get the
starting timestamp value by adding 24 hours worth of seconds to the
current time, e.g. $saturday=time()+24*3600; Alternatively you
can set $Saturday to time() and then in your loop, increment it
by 24*3600 before using it as a parameter to localtime.

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to