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