For Gregorian calendars, the date format varies from a country to another. There are three main formats recognized:
YY-MM-DD
(big-endian)DD-MM-YY
(little-endian)MM-DD-YY
(middle-endian)
Your task is to write a program which, given an input string representing a date, output all the possible date formats by which this string can be interpreted as a date.
Rules
- The input date is in the format
xx-xx-xx
, where each field is two digits and zero-padded. - The date is always valid (so you cannot get things like 14-13-17)
- The date is always at least one of the formats above (so you cannot get things like 17-14-11)
- Because we are in fact in a parallel world, there are 31 days for every month of the year, and consequently no leap years
- The date is between January 01, 2001 and December 31, 2099
- If there is only one format for the date, the code must print only it (only trailing newlines are allowed)
- If there are several formats for the date, they must be either separated by a comma, a space, a newline, or a combination of those
- You must output the exact name(s) of the format(s). Using distinct arbitrary values is not allowed.
- No leading or trailing characters others than a trailing space are allowed
- The output must be lowercase
- You are not allowed to use any built-in date or calendar functions
- The output formats do not have to be sorted
Examples
Input Output
30-05-17 big-endian, little-endian
05-15-11 middle-endian
99-01-02 big-endian
12-11-31 big-endian, little-endian, middle-endian
02-31-33 middle-endian
This is code-golf so the shortest code in bytes wins. Explanations are encouraged.
there are 31 days for every month of the year, and consequently no leap years
So this means any date library is effectively useless for this then? \$\endgroup\$