Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: What is a stringwise operator?

by halley (Prior)
on Feb 25, 2008 at 17:19 UTC ( #670052=note: print w/ replies, xml ) Need Help??


in reply to Re^2: What is a stringwise operator?
in thread What is a stringwise operator?

ISO 8601 Date and Time Specification Format

2007-10-05 11:34:22
Dates in the format above are inspired by the ISO Date and Time Specification Format, ISO 8601 for short. (Often, the Zulu is omitted, a minor faux-pas in ISO terms.) The benefits are obvious: since the digits are already in most-to-least significant order, the strings sort naturally in chronological order; also, by using standard separators the included or omitted fields can be parsed with confidence.

--
[ e d @ h a l l e y . c c ]


Comment on Re^3: What is a stringwise operator?
Download Code
Re^4: What is a stringwise operator?
by jhourcle (Prior) on Feb 25, 2008 at 18:34 UTC

    Order date/time from largest to smallest unit has been around a _lot_ longer than 8601 (1988) . However, the formatting being discussed will _not_ work generically for 8601 dates, as there are so many acceptable formats that it would NOT be reliable.

    8601 includes formats for DOY (day of year) and week of year:

    '2004-002' vs. '2004-W01-03' vs. '2004-01-01'

    Straight string comparison (without stripping delimiters) would also fail on comparing the mentioned format to an 8601 datetime, as they use a 'T' between the date and time portion, and the delimiters are optional for some formats:

    '2004-01-01T01:30Z' vs '20040101T0130Z'

    You also can't blindly strip delimiters and assume things are in the right order, as there's options for repetition and duration:

    'R3/2008-01-01P1D' vs. '2008-01-01P3D' vs. '2008-01-01/03' vs. '2008-01-01T00:00Z/03T24:00'

    But, the biggest (and most encountered, in my case) problem is that until the 2004 revision of 8601, it was acceptable to use 2 digit years, which meant that 6 digits without delimiters was YYMMDD, not YYYYMM:

    '200101' vs '2010-01'

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2014-11-28 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (200 votes), past polls