GNU bug report logs -
#11667
problem with command date
Previous Next
Full log
View this message in rfc822 format
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
This bug report was last modified 13 years and 42 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.