bug#11667: problem with command date

2012-06-10 Thread amanda sabatini
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

Sincerely,
Amanda Sabatini Dufek


bug#11667: problem with command date

2012-06-10 Thread Alan Curry
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
25

-- 
Alan Curry