Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^2: Comparing two dates without installing any modules

by mr_mischief (Monsignor)
on Dec 11, 2015 at 15:10 UTC ( #1150042=note: print w/replies, xml ) Need Help??

in reply to Re: Comparing two dates without installing any modules
in thread Comparing two dates without installing any modules

One could also let the user specify which date format they are using. It may even have field escapes to build a format like the date(1) command. Yet another option is to allow for year, month, and day arguments (-fromday -frommonth -fromyear -tomonth -today -toyear). One could also document ISO 8601 dates are taken by the program and reject anything that isn't one. There might be a Unix epoch timestamp option.

I find it odd that you would call using '-' as a separator an error. ISO 8601 demands it. The standard also works with week numbers and day-of-year numbers which can be quite handy sometimes. When writing new software which doesn't have to deal with legacy formats, I generally try to use a standard. If you're going to force a particular format, don't use one that encourages localization nightmares.

Replies are listed 'Best First'.
Re^3: Comparing two dates without installing any modules
by BillKSmith (Monsignor) on Dec 11, 2015 at 16:18 UTC
    Good point! Who can argue with standardization? (Except possibly the customer) Validation is still required to prevent common errors from propagating into the application.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2022-12-10 06:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found