andrewducker: (Default)
[personal profile] andrewducker
I think I just found the worst date format ever.

CVS, in its "Entries" file stores the timestamp that the file was last changed, so that you can check if it has been updated.

The timestamp is formatted like this: "Mon Dec  7 14:59:26 2010"

Now, to a human that's a perfectly readable format. But if you want a computer to understand it you've got to separate it into its component parts which are _completely_ out of order.

ISO 8601 is the international standard. And following that, the format would be "2010-12-20T14:59:26Z". Which is slightly harder to read as a human (because it's all smooshed together), but so much easier to parse with a computer. And has the bonus that if you sort a bunch of dates using normal character order they'll come out correctly.

CVS gets a bit of an out for being created in 1986, 2 years before ISO 8601. But as ISO 3307 was available from 1975, there were standards they totally _could_ have used.

(I can't find details on what the ISO 3307 date-time format looked like, but ISO 2014 said to use YYYY-MM-DD, so I can only assume that ISO 3307 did something reasonably sensible.)

Next task for today: Write a parser for that date format.

(And look forward to a glorious future when I won't have to touch CVS any more.)

Date: 2017-12-23 01:10 am (UTC)
birguslatro: Birgus Latro III icon (Default)
From: [personal profile] birguslatro
No. In Rebol, time is a datatype, same as integers and strings and such are datatypes. Which allows you to do this kind of thing with them...

>> 10:3:17 + 3:2:1
== 13:05:18

Date is also a datatype, and your one would look like this: 7-Dec-2010/14:59:26

So...

>> date: 7-Dec-2010/14:59:26
== 7-Dec-2010/14:59:26
>> date/year
== 2010
>> date/month
== 12
>> date/weekday
== 2

Which suggests your Mon is wrong. Rebol's weekdays start at 1 for Monday.

August 2025

S M T W T F S
      1 2
3 4 5 6 7 8 9
10 11 12 1314 15 16
17 18 19 20 21 22 23
24 25 26 27 28 2930
31      

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 31st, 2025 02:03 pm
Powered by Dreamwidth Studios