GNU bug report logs - #23270
Bug in 'date' command

Previous Next

Package: coreutils;

Reported by: Maarten <maarten <at> mastbroek.nl>

Date: Mon, 11 Apr 2016 17:07:01 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 23270 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Maarten <maarten <at> mastbroek.nl>, 23270 <at> debbugs.gnu.org
Subject: Re: bug#23270: Bug in 'date' command
Date: Mon, 11 Apr 2016 14:11:19 -0400
tag 23270 notabug
close 23270
thanks

Hello Maarten Mastbroek,

On 04/11/2016 12:36 PM, Maarten wrote:
> I recently discovered a bug, or at least unexpected behavior, about
> the ‘date’ command which I want to report.  The bug is related to the
> moment of ‘daylight saving time’ (summertime / wintertime)

This is not a bug (perhaps indeed unexpected behavior).

It is explained in the Coreutils FAQ:
 http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

Your diagnosis is correct:

> [...] When I request a ‘yesterday' request is about 24 hours before.

In GNU 'date', the relative period of 'yesterday' is defined exactly as 24 hours,
regardless of daylight saving time.

The recommended way to perform all relative day calculations is to specify 12:00pm,
so that adding/subtracting 24-hours avoids DST issues.

Example:
   date -d "12:00 yesterday"  +%d-%m-%Y

(similarly, when calculating relatives months, it is recommended to specify the 15th of the month, to avoid leap-years issues.)


As such I'm closing this bug, but discussion can continue by replying to this thread.

regards,
 - assaf








This bug report was last modified 6 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.