jfroebe has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
This is certainly odd behavior as I would expect this to work..
==============================================================#!/usr/bin/perl use strict; use warnings; my ($day, $month, $year) = (localtime)[3..5]; $year += 1900; my $date = "$year-$month-$day"; print "$date\n"; $date = localtime; print "$date\n";
produces:
2004-4-16
Sun May 16 22:27:20 2004
$ date
Sun May 16 22:19:52 CDT 2004
Now, according to Perl 5.8.0 localtime, this should be printing "2004-5-16". Perl 5.8.3 on Mandrake Linux 10.0.
Any ideas?
Jason L. Froebe
No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Weird Time: localtime shows wrong month
by broquaint (Abbot) on May 17, 2004 at 03:43 UTC | |
by jfroebe (Parson) on May 17, 2004 at 03:48 UTC | |
|
Re: Weird Time: localtime shows wrong month
by chiburashka (Initiate) on May 17, 2004 at 03:41 UTC |