[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11667: problem with command date

From: Alan Curry
Subject: bug#11667: problem with command date
Date: Sun, 10 Jun 2012 18:58:03 -0500 (GMT+5)

amanda sabatini writes:
> Hi,
> The follow command does not work with the specifics date: 1986-10-25;
> 1987-10-25; 1989-10-15; 1992-10-25; 1991-10-20; 1995-10-15; 2006-11-05.
> date +%d --date="1986-10-25"

The date command never actually works on dates alone. There is always a time
attached to its calculations, even when it's not necessary for the output
format you requested.

When you don't specify a time with the --date option, the command guesses
that you meant 00:00:00. That turns out to be a bad guess in this case, since
00:00:00 didn't exist on those days.

All of those are dates on which the Brazil/East time zone shifted into
daylight savings time, jumping from 23:59:59 the previous day to 01:00:00 on
the day you mentioned.

You can avoid this problem by adding 12:00:00 to the requested date.

$ TZ=Brazil/East date +%d --date="1986-10-25"
date: invalid date `1986-10-25'
$ TZ=Brazil/East date +%d --date="1986-10-25 12:00:00"

Alan Curry

reply via email to

[Prev in Thread] Current Thread [Next in Thread]