--thanks for the reply: --let me rephrase my question this way. i have just installed --the Date::Manip module. i have a test that looks like this:
[test script] #!/usr/bin/perl -w use strict; use Date::Manip; my $date = ParseDate("today"); my $pastdate = DateCalc($date, "-3 months"); print UnixDate($pastdate, " this was 3 months ago ... it looks like %D\n"); print "\n"; [/test script] --the output looks like this: [snip output] this was 3 months ago ... it looks like 08/08/02 [/snip output] --this is *almost* what I want ... BUT, i need to change the --two digit year into a 4 digit year. is there a method --while using, say, Date::Manip, to change the results --from 08/08/02 to 08/08/2002? -X -----Original Message----- From: Beau E. Cox [mailto:beau@;beaucox.com] Sent: Friday, November 08, 2002 4:25 PM To: Johnson, Shaunn; [EMAIL PROTECTED] Subject: RE: set date variable and range Hi - A silly question is one not asked... This script: #!/usr/bin/perl use strict; use warnings; # scalar context - prints 'readable' date my $now = localtime; print "$now\n"; # list context - returns a list of date parts my @parts = localtime; print "$_\n" for (@parts); returns this: Fri Nov 8 11:20:44 2002 44 20 11 8 10 102 5 311 0 Now I really don't know what you want to do, but the above is the essence of localtime. Look in the localtime documentation for a full description of the date parts. Aloha => Beau. -----Original Message----- From: Johnson, Shaunn [mailto:SJohnson6@;bcbsm.com] Sent: Friday, November 08, 2002 10:49 AM To: [EMAIL PROTECTED] Subject: set date variable and range Howdy: Silly perl question: I have a script where I'd like to set three date variables and pass them along in some sql script, but I'm having a problem trying to define the date variables using localtime(). [snip example] #!/usr/bin/perl use strict; use Date::Format; my @lt = localtime(time); print strftime (" %x", @lt); [/snip example] This almost gets me what I want, but I need all 4 digits for the year. I can try it this way, too: [snip example] my $day=(localtime())[3]; my $month=(localtime())[4]+1; my $year=(localtime())[5]; my $year=$year+1900; print "this is the value\n"; my $value="$month/$day/$year"; print $value; [/snip example] The result, $value, is something that I can use. But this seems cumbersome and I need to create a rolling 3 month window ... so I'd have to create an anchor date (let's say, today, which to base the rest of the dates from), a start date (the first month of the 3 month window) and the end date (the last month of the 3 month window). Is there an easier way to do this? I suppose what I'm looking for is what the example in the beginning of this email shows, but I'd like to have all 4 digits for the year and I'd only have to define 3 variables and not a lot more. How can I do this? Thanks! -X