<-----Original Message-----> From: steve silvers [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 1:26 PM To: [EMAIL PROTECTED] Subject: Get time and date for 2 weeks at a time
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? Thanks in advance Steve </-----Original Message-----> This is close. #!perl -w # treepad_calendar2.pl # # This program is used to output a Calendar for the TreePad program # Written by Charles Cave 13th April 2002 Sydney, NSW, Australia. # Contact: [EMAIL PROTECTED] # Treepad is found at http://www.treepad.com/ # Modified to output a calendar to track bike milage. July 2003 # $nodeid = 1; # incremented each time a node is written #days in month table @daysinmonth = (0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); @dayname = (" ", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"); @monthname = ("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", "January"); # Details of the first Monday of the Year # Make sure that $day and $month are set to a Monday! You need # to use the first week of the year where the Monday is in the current # year. So if the 1st Jan is on a Wednesday, you create week 2 # onwards, and manually include the previous week. $year = 2003; $month = 1; $day = 6; $dayofyear = $day; $dayofweek = 1; # Monday 1 up to Sunday 7 $weeknumber = 2; #usually 1 but it can be 2, for example in 2002 $dispmonth = $month; # incremented on change of month and used to display headings $firsttime = "Y"; &write_header; &write_node($year . " Log", 0, "Bike Log for the year $year"); $continue = "Y"; while ($continue) { if ($dayofweek == 1) { if (($firsttime) or ($day == 1) or (($daysinmonth[$month] - $day) < 6)) { write_node("$monthname[$dispmonth] $year", 1, "Monthly Log:\nMiles:\nTime:"); $firsttime = ""; $dispmonth++; $year++ if $dispmonth > 12; } write_node("Week of $day/$month", 2, "Week $weeknumber\nWeekly Log\nMiles:\nTime:"); $weeknumber++; } # Output Daily Plan $datestring = "$dayname[$dayofweek] $day/$month/$year"; write_node("$datestring", 3, "$datestring (Day $dayofyear)\nMiles:\nTime:\nRoutes:"); $day++; $dayofweek++; $dayofyear++; if ($dayofweek > 7) { $dayofweek = 1; } if ($day > $daysinmonth[$month]) { $month++; $day=1; } if ($month > 12) { $continue = ""; } } _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs