Is this the worst date format ever?
Dec. 19th, 2017 09:23 amI 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.)
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.)