Thank you to all who contributed to this discussion. Not only did this assist
me in my problem, but I learnt a lot from the various contributions. Thanks so
muchZilore
___
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscr
Luebkert
> Envoyé : jeudi 4 décembre 2008 00:49
> À : activeperl@listserv.activestate.com
> Objet : Re: How to get yesterday's date in Perl
>
> [EMAIL PROTECTED] wrote:
> >> This occurs on the 23th hour in the fall and the 0th hour
> in the spring.
> > This pro
[EMAIL PROTECTED] wrote:
>> This occurs on the 23th hour in the fall and the 0th hour in the spring.
> This program shows a brute force way
>> to find these that might convince you [1].
>
>
> Slick! I'm convinced. Hmm, so if you need it to be ever accurate (and want
> to stay w/ localtime() you
> now I'm confused ...
my ($isdst) = ( localtime() ) [8];
my ($mday, $mon, $year, $prev_isdst) = (localtime(time - 60 * 60 * 24) )[
3,4,5, 8];
printf("%d/%02d/%02d\n", $year + 1900, $mon + 1,
$isdst == $prev_isdst ? $mday
: $isdst > $prev_isdst ? (localtime($t - 60 * 60 * 23) )[ 3]
:
[EMAIL PROTECTED]
>> > This occurs on the 23th hour in the fall and the 0th hour in the
>> > spring. This program shows a brute force way to find these that
>> > might convince you [1].
>> >
>> Slick! I'm convinced. Hmm, so if you need it to be ever accurate
>> (and want to stay w/ localtime() yo
> This occurs on the 23th hour in the fall and the 0th hour in the spring.
This program shows a brute force way
> to find these that might convince you [1].
Slick! I'm convinced. Hmm, so if you need it to be ever accurate (and want
to stay w/ localtime() you need to track changes in the DST fiel
On Dec 3, 2008, at 10:25 , [EMAIL PROTECTED] wrote:
>Yes. There are 2 hours each year when this formula is wrong.
I assume you're thinking of the switch from DST to CST and vice-
versa, yes? But since that change occurs at oh-dark-hundred
(2:00AM), it's already "today," and "yesterday" wo
>Yes. There are 2 hours each year when this formula is wrong.
No, there are 2 hours each year where the 'time' fields wouldn't be exactly
24 hours earlier, but the date should be skookum
> More seriously, isn't this code subtracting a day twice?
my ($mday, $mon, $year) = (localtime(time()
>Yes. There are 2 hours each year when this formula is wrong.
I assume you're thinking of the switch from DST to CST and vice-versa,
yes? But since that change occurs at oh-dark-hundred (2:00AM), it's
already "today," and "yesterday" would be the same, wouldn't it? Or is it
a different pair o
On Dec 3, 2008, at 8:34 , Henry Hartley wrote:
> [EMAIL PROTECTED] wrote:
>
>>> (by default, 'time()' is the param for localtime() ). So you can
>>> get the values for yest by subtracting 1 day worth of seconds:
>>> my ($mday, $mon, $year) = (localtime(time() - 60 * 60 * 24) )
>>> [ 3,4,5];
>>>
[EMAIL PROTECTED] wrote:
>> (by default, 'time()' is the param for localtime() ). So you can
>> get the values for yest by subtracting 1 day worth of seconds:
>> my ($mday, $mon, $year) = (localtime(time() - 60 * 60 * 24) ) [ 3,4,5];
>> printf("%d/%02d/%02d\n", $year + 1900, $mon + 1, $mday - 1);
> After browsing a lot of documentation I cannot find how to get
yesterday's or tomorrow's date in Perl, like `date --date "-1 day"
"+%Y%m%d"` in bash.
localtime() takes an epoc number (number of seconds from 1/1/1970) and
produces either the date data list (perldoc -f localtime)::
# 01
yestm/$yestd/$yesty\n" ;
--
Henry
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of zilore mumba
Sent: Wednesday, December 03, 2008 10:09 AM
To: activeperl@listserv.activestate.com
Subject: RE: How to get yesterday's date in Perl
thanks for the resp
thanks for the response, but it is still not clear to me. What do I put in
qw(Add_Delta_Days)?
Thanks
Zilore
--- On Wed, 12/3/08, Singer, Erich <[EMAIL PROTECTED]> wrote:
From: Singer, Erich <[EMAIL PROTECTED]>
Subject: RE: How to get yesterday's date in Perl
To: [EMAIL PROTE
Hello
use Date::Calc qw(Add_Delta_Days)
Erich
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of zilore
mumba
Sent: Wednesday, December 03, 2008 7:05 AM
To: activeperl@listserv.activestate.com
Subject: How to get yesterday's date in Perl
After b
time - 24*60*60 is a quick guess
zilore mumba wrote:
After brouwsing a lot ofdocumentation I cannot find how to get
yesterday's or tomorrow's date in Perl, like `date --date "-1 day"
"+%Y%m%d"` in bash. Is this possible in Perl?
I am making date directories, like 20081203. If I add, I get a
From: zilore mumba <[EMAIL PROTECTED]>
> After brouwsing a lot ofdocumentation I cannot find how to get
> yesterday's or tomorrow's date in Perl, like `date --date "-1 day"
> "+%Y%m%d"` in bash. Is this possible in Perl?
>
> I am making date directories, like 20081203. If I add, I get a problem
>
17 matches
Mail list logo