Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: sorting mm/dd/yy

by royalanjr (Chaplain)
on Dec 15, 2000 at 20:23 UTC ( #46837=note: print w/replies, xml ) Need Help??


in reply to sorting mm/dd/yy

Which format do you folks would be best for storing dates then? The ISO YYYYMMDD, or unix epoch?

Roy Alan

Replies are listed 'Best First'.
Re: Re: sorting mm/dd/yy
by merlyn (Sage) on Dec 15, 2000 at 20:30 UTC

      That is what I have been doing at the moment. I use Time:ParseDate to turn the date into epoch and store that. Then when I need the formated into something a human can understand, I use localtime() to change it back.

      Someone changed the time zone on the server and it knocked all the dates out of whack. I had to write a script to make up for the time zone hour shift to make the dates right.

      Now, did I just do something bone-headed when I chose that scheme for the dates, or what?

      Roy Alan

        I may be wrong here, so umm, don't shoot me, but I believe that epoch timestamps are always given for UTC. Time::ParseDate does some manipulation depending on what your timezone, but there's a whole lot of options to tell T::PD how to handle the input time, so you could tell it that all dates being given to it are from a certain timezone (ie. before the date that you changed the timezone, tell T:PD to use one timezone, afterwords, tell it to use another) and that should pretty much straighten out any inconsistencies you have.

        I might be wrong about the epoch thing, but you can most certainly make up for shifts like that in T:PD itself.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2021-01-17 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?