GNU bug report logs - #11667
problem with command date

Previous Next

Package: coreutils;

Reported by: amanda sabatini <amanda.dufek <at> gmail.com>

Date: Sun, 10 Jun 2012 17:57:02 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: amanda.dufek <at> gmail.com (amanda sabatini)
Cc: 11667 <at> debbugs.gnu.org
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"
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.