Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Time Zones and Users

by belg4mit (Prior)
on Jan 11, 2002 at 10:56 UTC ( #137958=note: print w/replies, xml ) Need Help??


in reply to Time Zones and Users

Try this:
perl -e 'print scalar localtime; $ENV{TZ}="PST"; print scalar localtim +e;'
Assuming you aren't in PST. and then you might just local the TZ within a block when you do the calculations etc.

PD> Corollary, let the OS and perl internal magic do as much work for you as it can.

--
perl -pe "s/\b;([st])/'\1/mg"

Replies are listed 'Best First'.
Re: Re: Time Zones and Users
by Torgo (Beadle) on Jan 11, 2002 at 22:27 UTC
    Hmmm. That's a good method, but it doesn't seem to work for Windows servers. Yeah, a crime against nature, but it's a requirement, and it's making this simple issue into a total beast.

    Thor, your idea of just setting a +/- X hours is nice, but doesn't take into account Daylight Savings Time. A lot of the world and some parts of America (Arizona, east Indiana) don't deal with it at all. If you do DST in your area, Check the current time on this site. If you set your options when our clocks were forward, it'll be off by one hour. That's fine for a realtime site like this, but no good for a scheduling app.

    --
    I write the code while the master is away!
      Ummm, I never said anything about +/- X hours...

      --
      perl -pe "s/\b;([st])/'\1/mg"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://137958]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2022-05-23 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?