develooper Front page | perl.beginners | Postings from April 2002

Re: Backing up two days from localtime

Thread Previous
Jeff 'japhy' Pinyan
April 25, 2002 23:06
Re: Backing up two days from localtime
Message ID:
On Apr 26, Tara Calishain said:

>I need to back up two days from localtime and I can't figure out how to do
>it. Currently I'm doing this just so I can work out the rest of the program:
>($day, $month, $year) = (localtime) [3,4,5]; #getting your local time 

The generic (read: potentially unsafe) way is to fix the problem right

  ($day, $month, $year) = (localtime(time - 86400*2))[3,4,5];

The only place to worry about this is during the switch to/from Daylight
Savings Time, at 2:00 am, twice a year.

Jeff "japhy" Pinyan
RPI Acacia brother #734
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About