[LA.pm] OT: changing the date timezone for perl use

Peter Scott Peter at PSDT.com
Thu Jun 23 09:50:07 PDT 2005


At 09:05 AM 6/23/2005, David Heayn wrote:
>I have an ultra simple perl script that requests the current
>date/time from a shared server (not mine) then spits out the html
>dressing.
>
>My problem is the server is set to Pacific time and I need Eastern time.
>
>Anyone have any suggestions/alternative server time mechanisms. I'd
>rather not go in and program a complete time zone remapping function.

Um, since eastern time is always 3 hours ahead of pacific, you should 
just be able to do


% date
Thu Jun 23 09:47:35 PDT 2005

% perl -MDate::Parse -le 'print scalar localtime(str2time("Thu Jun 23 
09:38:22 PDT 2005")+3600*3)'
Thu Jun 23 12:38:22 2005


I can't tell from your post whether your program is running on the same 
machine that's giving you the date you want, what format you're getting 
it in, or what format you want it in.
-- 
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/
http://www.perlmedic.com/



More information about the Losangeles-pm mailing list