Schaelle has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks!
One of my daily running applications (6am) needs the yesterdays date, or better the date of $param-1day.
Yesterday, sunday, was here in germany the change from 2am to 3am. Running on sunday with date=20100328 it was correct yday=20100327. But I got today with date=20100329 yday=20100327 again.
Code for this:
#!/bin/perl use strict; use Time::Local; die "Wrong parameter count." unless scalar(@ARGV) == 1; die "Wrong parameter format." unless $ARGV[0] =~ /(\d{4})(\d{2})(\d{2} +)/; my @d = localtime(timelocal(0, 0, 0, $3, $2-1, $1) - 86400); printf("%04d%02d%02d", ($d[5]+1900), $d[4]+1, $d[3]);
My question is now how I can fix this issue?
I searched for another module wich help me on this, but Date::Manip have the same problems (reported in "Known Bugs") and Date::Calc have to much dependencies that I have to install, just for task.
Greetings, Schaelle
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Yesterdays date while daylight saving time change
by moritz (Cardinal) on Mar 29, 2010 at 08:44 UTC | |
by Schaelle (Novice) on Mar 29, 2010 at 09:27 UTC | |
|
Re: Yesterdays date while daylight saving time change
by JavaFan (Canon) on Mar 29, 2010 at 08:43 UTC | |
by Schaelle (Novice) on Mar 29, 2010 at 09:22 UTC | |
by JavaFan (Canon) on Mar 29, 2010 at 09:55 UTC | |
by Schaelle (Novice) on Mar 29, 2010 at 09:59 UTC | |
|
Re: Yesterdays date while daylight saving time change
by Corion (Patriarch) on Mar 29, 2010 at 08:43 UTC | |
by JavaFan (Canon) on Mar 29, 2010 at 08:59 UTC |