[30352] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1595 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 30 16:09:54 2008

Date: Fri, 30 May 2008 13:09:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 30 May 2008     Volume: 11 Number: 1595

Today's topics:
    Re: FAQ 4.17 How do I find yesterday's date? <hjp-usenet2@hjp.at>
    Re: FAQ 4.17 How do I find yesterday's date? <noreply@gunnar.cc>
    Re: FAQ 4.17 How do I find yesterday's date? <simon.chao@fmr.com>
    Re: FAQ 4.17 How do I find yesterday's date? <noreply@gunnar.cc>
    Re: How to make input user and password in perl script  <fdsa@jklh.dili5na>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 30 May 2008 19:54:41 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.17 How do I find yesterday's date?
Message-Id: <slrng40fr1.73f.hjp-usenet2@hrunkner.hjp.at>

On 2008-05-29 00:54, David Combs <dkcombs@panix.com> wrote:
> In article <481e54c4$0$33218$815e3792@news.qwest.net>,
> Andrew DeFaria  <Andrew@DeFaria.com> wrote:
>>>>> Most people try to use the time rather than the calendar to figure 
>>>>> out dates, but that assumes that days are twenty-four hours each. 
>>>>> For most people, there are two days a year when they aren't: the 
>>>>> switch to and from summer time throws this off. Let the modules do 
>>>>> the work.
[...]
>>Besides - 86400 is reliable here! Here in Arizona that is! Wish you guys 
>>would wise up and stop changing your clocks all the time. It's damn 
>>annoying! ;-)
>
>
> I'm still not sure, from what you guys have discovered,
> what the faq *should* say?  

The FAQ should say what it actually says (well, it could also mention
localtime/mktime - I'm not sure if the two modules it mentions are part
of the core). 


> Eg suggested explanations for a boss who complains
> about how it works on those two days or not within a certain
> part of the day?

It works correctly if you follow the advice in the FAQ. If you do what
the FAQ says you shouldn't do, it may work in Arizona (Andrew is lucky
not having to put up with that DST insanity) but not in many other
parts of the world.


> I wonder how the finance and legal worlds handle this
> stuff, eg in a contract?

Mostly by ignoring it, I guess. The time shift occurs in the wee hours
of sunday morning. The finance and legal worlds don't do much at that
time. 

	hp


------------------------------

Date: Fri, 30 May 2008 20:39:03 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FAQ 4.17 How do I find yesterday's date?
Message-Id: <6ab01bF36t3v3U1@mid.individual.net>

Peter J. Holzer wrote:
> On 2008-05-29 00:54, David Combs <dkcombs@panix.com> wrote:
>> I'm still not sure, from what you guys have discovered,
>> what the faq *should* say?  
> 
> The FAQ should say what it actually says (well, it could also mention
> localtime/mktime - I'm not sure if the two modules it mentions are part
> of the core).

They are not part of the core.

The core module Time::Local + localtime() are sufficient to answer the 
FAQ question safely.

     use Time::Local;
     my $today = timelocal 0, 0, 12, ( localtime )[3..5];
     my ($d, $m, $y) = ( localtime $today-86400 )[3..5];
     printf "Yesterday: %d-%02d-%02d\n", $y+1900, $m+1, $d;

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Fri, 30 May 2008 11:45:37 -0700 (PDT)
From: nolo contendere <simon.chao@fmr.com>
Subject: Re: FAQ 4.17 How do I find yesterday's date?
Message-Id: <85f6ad73-aa22-42be-bb84-888c6a52baee@z66g2000hsc.googlegroups.com>

On May 30, 2:39=A0pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Peter J. Holzer wrote:
> > On 2008-05-29 00:54, David Combs <dkco...@panix.com> wrote:
> >> I'm still not sure, from what you guys have discovered,
> >> what the faq *should* say? =A0
>
> > The FAQ should say what it actually says (well, it could also mention
> > localtime/mktime - I'm not sure if the two modules it mentions are part
> > of the core).
>
> They are not part of the core.
>
> The core module Time::Local + localtime() are sufficient to answer the
> FAQ question safely.
>
> =A0 =A0 =A0use Time::Local;
> =A0 =A0 =A0my $today =3D timelocal 0, 0, 12, ( localtime )[3..5];
> =A0 =A0 =A0my ($d, $m, $y) =3D ( localtime $today-86400 )[3..5];
> =A0 =A0 =A0printf "Yesterday: %d-%02d-%02d\n", $y+1900, $m+1, $d;
>

Doesn't Peter's post contradict this, since his example demonstrated
that the -86400 can lead to a result that is 2 days older?


------------------------------

Date: Fri, 30 May 2008 20:51:53 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FAQ 4.17 How do I find yesterday's date?
Message-Id: <6ab0pdF34pgk5U1@mid.individual.net>

nolo contendere wrote:
> On May 30, 2:39 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> Peter J. Holzer wrote:
>>> On 2008-05-29 00:54, David Combs <dkco...@panix.com> wrote:
>>>> I'm still not sure, from what you guys have discovered,
>>>> what the faq *should* say?  
>>> The FAQ should say what it actually says (well, it could also mention
>>> localtime/mktime - I'm not sure if the two modules it mentions are part
>>> of the core).
>> They are not part of the core.
>>
>> The core module Time::Local + localtime() are sufficient to answer the
>> FAQ question safely.
>>
>>      use Time::Local;
>>      my $today = timelocal 0, 0, 12, ( localtime )[3..5];
>>      my ($d, $m, $y) = ( localtime $today-86400 )[3..5];
>>      printf "Yesterday: %d-%02d-%02d\n", $y+1900, $m+1, $d;
> 
> Doesn't Peter's post contradict this, since his example demonstrated
> that the -86400 can lead to a result that is 2 days older?

No. Can't you spot a difference between the above code and

     print scalar localtime(time-86400);

??

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Fri, 30 May 2008 11:25:59 -0700
From: "Gordon Etly" <fdsa@jklh.dili5na>
Subject: Re: How to make input user and password in perl script started on web?
Message-Id: <6aav5pF3173onU1@mid.individual.net>

Jürgen Exner wrote:
> fishfry <BLOCKSPAMfishfry@your-mailbox.com> wrote:

> > More helpfulness (not) from this newsgroup.

> -v, please?

What does this mean? Version of what he wrote?


> > No wonder PHP's kicking Perl's ass in the real world.

> What does the one language have to do with the other? Maybe PHP
> inherited certain designs from Perl, but they were designed for very
> different purposes.

Actually I believe PHP inherited some things from Perl 4.


> > I'm sick to death of the newbie-bashing around here.

> Maybe you could post a more appropriate reply to the OP such that we
> all can learn?

It's funny to say that when the negative posting that comes from certain 
regulars doesn't add any such learning either, yet I don't see the likes 
of you complain about them.


-- 
G.Etly 




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1595
***************************************


home help back first fref pref prev next nref lref last post