The encoding of calendar dates as strings in a format YYYY-MM-DD(with or without delimiters, for example 2014-04-21, 2014.04.21or 20140421) has the following properties:
- Sorting strings lexicographically ascending (treating them as simple strings that do not know what they represent) puts them in chronological order
- The conversion between the calendar date and the string is obvious to people (
2014-04-21obviously represents April 21, 2014)
Note that for this, each date component (year, month, and day) should always use the same number of characters with leading zeros if the number is too small. This means that YYYYcan only represent years before 9999. If we want to represent also five-digit years, then the date in my example will be higher 02014-04-21.
Question:
Is there a way to encode calendar dates as strings, so sorting lexicographically increasing strings puts them in reverse chronological order?
Ideally, it would be easy for a person to convert the calendar date and the format that you offer, but even if you do not (my solution does not fit below), I still want to know your solution.
If this helps, you may require this restriction:
, , :
- , . 2100
- -- (2100-), (13-), (32-) , , .
- ,
Apr 21, 2014 86-09-11
, , 86-09-11 April 21, 2014.
:
- ,
YYYY-MM-DD . , . - , . , , " 1 2100 " .
- , , .
- /. ,
2001-01-02 ( 2 , 1 ). : , , , ( YYYY-MM-DD), .