Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Compare two dates

by Marshall (Canon)
on Jul 23, 2019 at 06:31 UTC ( [id://11103192]=note: print w/replies, xml ) Need Help??


in reply to Re: Compare two dates
in thread Compare two dates

Yes, in the USA: MM/DD/YYYY is also common. However just like DD.MM.YYYY, there may not be leading zero'es for the days or months.

I prefer one of the 12 formats shown in my previous post so that an ASCII sort order will work. Converting a date to a numeric value for comparisons will work and I don't have any big quibble with that. But I would run a regex to convert: DD.MM.YYYY to YYYY-MM-DD for storage and processing purposes. Wenn der Benutzer ein Deutscher ist, würde ich die Ziffernreihenfolge für Anzeigezwecke ändern. Or maybe not? My German is not that great!

Update:
I use YYYY-MM-DD as expressed in GMT/UTC time zone for all of my logging. If some conversion to local time formats for a user display is necessary, I do that. However almost all of my work is in GMT/UTC. Yes there is a small technical difference between these two definitions of time. For my work, this difference just doesn't matter. Some DB's use a numeric value for the date and some use a string. Any DB that uses a numeric value for a date, has a function to generate that numeric value from YYYY-MM-DD.

I use the terms GMT and UTC interchangeably. See Coordinated Universal Time. This wiki article notwithstanding, I recollect that there is some extremely small difference having to do with small fractions of seconds related to this "leap second" stuff. Nobody here has to worry about UTC vs GMT => for all practical purposes, they are the same.

Replies are listed 'Best First'.
Re^3: Compare two dates
by Anonymous Monk on Jul 23, 2019 at 22:56 UTC
    Comparing strings usually takes longer than comparing numbers. Keep that in mind.
      Maybe, but it's two strings vs. two to six numbers (years, months, days) …

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-20 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found