Subject: Re: bug#14146: [date command] Possible bug
From: Eric Blake <[email-masked]>
To: Ivan Lombardi Borgia <[email-masked]>
Cc: [email-masked]
Date: Fri, 05 Apr 2013 09:24:27 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

tag 14146 notabug
thanks

On 04/05/2013 03:13 AM, Ivan Lombardi Borgia wrote:
> Good morning,
> 
> for the 1th of April 2013 the command *date *has this interesting behaviour:
> *
> *
> *$ date*
> *Mon Apr  1 00:22:31 CEST 2013*
> *$ date -d 'yesterday'*
> *Sat Mar 30 23:22:38 CET 2013*

Did you notice the change in the time zone name from CEST to CET, based
on daylight savings?

> That doesn't happen for year 2012 and 2014.

Yeah, because daylight savings in your timezone falls on a different
date in those years.

> If you need more information just ask and I will try to respond as soon as
> possible.

You are hitting a typical usage problem.  This is not a bug in date, but
in your usage of it; you are failing to account that "yesterday"
translates to "24 hours ago", but that 24 hours ago close to midnight
when crossing over a 23-hour day (thanks to daylight savings) can cross
2 calendar days.

For more information, including the tip to base relative date
computation on noon instead of close to midnight, see the FAQ:

https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

As such, I'm closing this as not a bug, although you may feel free to
continue replying if you have further questions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org