G
Gerry George
I have a problem in that the month I get returned from the localtime
is always the prior month rather than the current month. The following
is a little program that just prints out the localtime components. For
reference, today's date is May 26, 2004 (5/26/2004), but I always get
4/26/2004.
################################################
#!/usr/perl5/bin/perl
use Time::localtime;
$lt = localtime;
$mevsyr = $lt->year;
$mevsccyy = $lt->year;
$mevsmo = $lt->mon;
$mevsday = $lt->mday;
$mevshour = $lt->hour;
$mevsmin = $lt->min;
print "mevsyr: $mevsyr\n";
print "mevsccyy: $mevsccyy\n";
print "mevsmo: $mevsmo\n";
print "mevsday: $mevsday\n";
print "mevshour: $mevshour\n";
print "mevsmin: $mevsmin\n";
###############################################
results:
mevsyr: 104
mevsccyy: 104
mevsmo: 4 ????????????? s/b 5
mevsday: 26
mevshour: 12
mevsmin: 31
The above is true regardless of platform (Unix or Windows). I use perl
5.00503 on Unix and perl 5.8 on Windows. I am relatively new at this
so I could be doing something wrong, but I don't think so. Any help
you can give is greatly appreciated. Thanks.
is always the prior month rather than the current month. The following
is a little program that just prints out the localtime components. For
reference, today's date is May 26, 2004 (5/26/2004), but I always get
4/26/2004.
################################################
#!/usr/perl5/bin/perl
use Time::localtime;
$lt = localtime;
$mevsyr = $lt->year;
$mevsccyy = $lt->year;
$mevsmo = $lt->mon;
$mevsday = $lt->mday;
$mevshour = $lt->hour;
$mevsmin = $lt->min;
print "mevsyr: $mevsyr\n";
print "mevsccyy: $mevsccyy\n";
print "mevsmo: $mevsmo\n";
print "mevsday: $mevsday\n";
print "mevshour: $mevshour\n";
print "mevsmin: $mevsmin\n";
###############################################
results:
mevsyr: 104
mevsccyy: 104
mevsmo: 4 ????????????? s/b 5
mevsday: 26
mevshour: 12
mevsmin: 31
The above is true regardless of platform (Unix or Windows). I use perl
5.00503 on Unix and perl 5.8 on Windows. I am relatively new at this
so I could be doing something wrong, but I don't think so. Any help
you can give is greatly appreciated. Thanks.