Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

New timezones and datetime format

by tye (Cardinal)
on Aug 23, 2002 at 19:12 UTC ( #192415=monkdiscuss: print w/ replies, xml ) Need Help??

Just a quick note. user settings now includes a link to Timezone Settings which lets you pick a real timezone with support for (likely) your local daylight-savings time or "summer time" schedule.

Most datetimes are currently still displayed using old code that doesn't handle timezones properly. So I've updated the default datetime format so that places that support the real timezones will show you a timezone string (like "EDT"), mostly just on home nodes and the second line of the "Tick Tock" nodelet.

Datetimes that don't report this are likely either showing you a time in the server's local timezone (America/New_York) or (such as the dates at the tops of nodes) are trying to show you the time in your timezone based on the incorrect assumption that the server is running in GMT.

There is also a new field in user settings that lets you set the format you want to see datetimes shown in. Put any strftime()-compatible string, such as "%Y-%m-%d %H:%M:%S %Z", and the (currently few) places that handle the new timezones will use it. (See also strftime reference for Win32.)

So expect clean-up to continue (though, not be me for a while, I'm on vacation).

        - tye (but my friends call me "Tye")

Comment on New timezones and datetime format
Download Code
Re: New timezones and datetime format
by BUU (Prior) on Aug 23, 2002 at 20:13 UTC
    Thats a good fix, but i had an idea for another one. It seems to me that all the datetimes here now are all 'absolute' (ignoring any arguements about what is absolute, is time absolute, etc). Why not a relative datetime? '2 days ago' Means a lot more then 'august 19' (or whatever day it was)Also note that this has the advantange of being totally timezone agnostic.

      Write code to handle a combination strftime/reltime format, given every concevibly useful format, and I'll see about hammering it into the time-formatting code here. Remember that people generaly are going to want sliding-scale precision here -- I care about rel. seconds if it's within a day, but I don't even care about rel. hours if it's over a year.


      Confession: It does an Immortal Body good.

        I always care about a node's exact time. It may not be interesting compared to when I'm reading a node, but is compared to its siblings' times. If a relative format was in use, I might use it if it can be shown in addition to the absolute times. If not, I'd switch it off (and be very annoyed if I can't, naturally).

        Makeshifts last the longest.

Re: New timezones and datetime format
by Chady (Priest) on Aug 24, 2002 at 08:41 UTC

    hmm... mine is not listed... how about Asia/Beirut ?

    that's +10 minutes from Asia/Damascus...
    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
Re: New timezones and datetime format
by theorbtwo (Prior) on Sep 02, 2002 at 06:34 UTC

    Oh, and BTW, if you need docs on what a "strftime()-compatable string" is, see the manpage (this is the Single Unix Specification manpage -- we actualy accept any strftime format that the purticular libc on the webserver can handle, but I don't know exactly what libc, and don't feel like looking for docs).


    Confession: It does an Immortal Body good.

Re: New timezones and datetime format
by ysth (Canon) on Oct 05, 2004 at 16:27 UTC
    We want to avoid adding timezones that are identical in offset, dst rules, and abbreviation. But should we add timezones such as Asia/Singapore, which is identical to Asia/Makassar (offset UTC+8, no dst) except that the abbreviation is SGT instead of CIT? If users really want, they could select Asia/Makassar and replace the %Z in the format with SGT.

    (In a case such as America/Cuba, where there is dst, this doesn't work since the abbreviation isn't constant.)

      No, there are tons of such "duplicate except for abbreviation" timezones so I don't think we should add any of them as it would mostly make timezone settings unwieldy.

      You could make the argument that Asia/Makassar should be replaced with Asia/Singapore. I won't pretend to know which is more widely used or by how much (but will note that I've heard of Singapore but I don't recall having heard of Makassar).

      You could also write the patch to allow people to type in their own timezone string and validate that the one they selected is currently supported by the operating system. I just set my timezone to Asia/Singapore by typing in a URL by hand but that doesn't do a good job of telling me if I entered an invalid timezone and isn't a friendly interface for more obvious reasons. If at the same time you made the backward-compatibility and backward GMT offset timezones less visible, that would be nice. (:

      - tye        

      I understand this is a _very_ old thread, but I just noticed what appears to be a minor bug.

      The offsets shown in the drop-down list on the User Settings node appear to be back-to-front. For example, I am in Singapore which is GMT +8, but my local time appears in the drop-down as GMT -8.

      -- Darren
Re: New timezones and datetime format
by jdporter (Canon) on Apr 28, 2006 at 12:21 UTC

    The "Format for date-times" field in User Settings now accepts the string ISO as a convenient alias for
    %Y-%m-%d %H:%M:%S %Z

    We're building the house of the future together.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://192415]
Approved by ignatz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-08-20 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (110 votes), past polls