Because "
-I" tells it to use ISO-8601 format, and
according to Wikipedia ISO-8601 section 4.2.2.4 states:
Quote:
Originally Posted by ISO 8601:2004(E), ISO, 2004-12-01, 4.2.2.4
... the decimal fraction shall be divided from the integer part by the decimal sign specified in ISO 31-0, i.e. the comma [,] or full stop [.]. Of these, the comma is the preferred sign.
|
Looks like the author(s) of the date command decided to go with the "preferred sign" rather than take locale into account (which the standard allows). It's also disappointing they didn't bother to document that they had done so.
The actual ISO-8601 standard is frustratingly behind a paywall, but
RFC 3339 is a subset which isn't - and it explicitly only goes with decimal point:
Quote:
Originally Posted by RFC 3339 section 5.6
date-fullyear = 4DIGIT
date-month = 2DIGIT ; 01-12
date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on
; month/year
time-hour = 2DIGIT ; 00-23
time-minute = 2DIGIT ; 00-59
time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second
; rules
time-secfrac = "." 1*DIGIT
time-numoffset = ("+" / "-") time-hour ":" time-minute
time-offset = "Z" / time-numoffset
partial-time = time-hour ":" time-minute ":" time-second
[time-secfrac]
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset
date-time = full-date "T" full-time
|
However, the date command's implementation of RFC 3339 is incorrect - because whilst "
date --rfc-3339=ns" does indeed give a decimal point, it neglects to output the T (which is a useful indicator of a standards-compliant date value), so to get the desired format one must manually construct it: "
date '+%FT%T.%N%:z'"