Parsing date inconsistency -d

How does the parser work date?

date -d "2010-08-12 05:30:30.102 AM + 0 months"
Thu Aug 12 05:30:30 EDT 2010

but

date -d "2010-08-12 05:30:30.102 + 0 months"
Thu Aug 12 01:30:30 EDT 2010
+4
source share
1 answer

It seems to be + 0interpreted as a UTC bias when AMnot turned on. However, when turned on AM, it is no longer ambiguous whether or not it is + 0for an offset or if it belongs months, because the UTC offsets are only valid when using 24-hour time.

In the first case, it is only monthsinterpreted as + 1 months(at least in some versions date) as the ghoti mentioned in the comments.

, date -d "2010-08-12 05:30:30 +0" . date -d "2010-08-12 05:30:30 AM +0" , UTC , AM.

+3

Source: https://habr.com/ru/post/1692123/


All Articles