Coplan has asked for the wisdom of the Perl Monks concerning the following question:
As I said, the script returns "2001-01-13" if I ran the script on February 13th. I guess I could always add one to the month -- but I want to make sure it isn't something I did wrong otherwise.#!/usr/bin/perl use strict; my $date_parsed = get_date(); print "Date Parsed: $date_parsed\n"; # gets parse-time date for release date sub get_date { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtim +e(time); $year += 1900; ($mon, $mday) = (sprintf('%02d', $mon), sprintf('%02d', $mday)); return $year."-".$mon."-".$mday; };
--Coplan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: month off by one?
by lemming (Priest) on Feb 14, 2001 at 01:28 UTC | |
|
Re: month off by one?
by japhy (Canon) on Feb 14, 2001 at 01:28 UTC | |
|
Re: month off by one?
by goldclaw (Scribe) on Feb 14, 2001 at 01:33 UTC | |
|
Re: month off by one?
by myocom (Deacon) on Feb 14, 2001 at 01:29 UTC | |
|
Re: month off by one?
by KM (Priest) on Feb 14, 2001 at 02:09 UTC | |
|
Re: month off by one?
by Anonymous Monk on Feb 14, 2001 at 03:23 UTC |