GNU bug report logs - #15752
Date problem

Previous Next

Package: coreutils;

Reported by: Andy Lamb <andy <at> andy-lamb.com>

Date: Wed, 30 Oct 2013 02:06:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15752 in the body.
You can then email your comments to 15752 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#15752; Package coreutils. (Wed, 30 Oct 2013 02:06:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andy Lamb <andy <at> andy-lamb.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 30 Oct 2013 02:06:01 GMT) Full text and rfc822 format available.

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

From: Andy Lamb <andy <at> andy-lamb.com>
To: bug-coreutils <at> gnu.org
Subject: Date problem
Date: Tue, 29 Oct 2013 21:58:05 -0400
Hello,

February of 2013 does not work, it comes up with March twice!

/bin/date --date=-6 month +%b%Y = Apr2013
/bin/date --date=-7 month +%b%Y = Mar2013
/bin/date --date=-8 month +%b%Y = Mar2013
/bin/date --date=-9 month +%b%Y = Jan2013

Neither of these work:

file /bin/date
/bin/date: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

file /bin/date
/bin/date: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

Thanks,
Andy




Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Wed, 30 Oct 2013 03:03:01 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Wed, 30 Oct 2013 03:03:02 GMT) Full text and rfc822 format available.

Notification sent to Andy Lamb <andy <at> andy-lamb.com>:
bug acknowledged by developer. (Wed, 30 Oct 2013 03:03:03 GMT) Full text and rfc822 format available.

Message #12 received at 15752-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Andy Lamb <andy <at> andy-lamb.com>, 15752-done <at> debbugs.gnu.org
Subject: Re: bug#15752: Date problem
Date: Tue, 29 Oct 2013 21:02:05 -0600
[Message part 1 (text/plain, inline)]
tag 15752 notabug
thanks

On 10/29/2013 07:58 PM, Andy Lamb wrote:
> Hello,
> 
> February of 2013 does not work, it comes up with March twice!
> 
> /bin/date --date=-6 month +%b%Y = Apr2013
> /bin/date --date=-7 month +%b%Y = Mar2013
> /bin/date --date=-8 month +%b%Y = Mar2013
> /bin/date --date=-9 month +%b%Y = Jan2013

This is a FAQ:

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

Subtracting by months is fuzzy (does it mean multiples of 28, 29, 30, or
31 days?  What is one month after Oct 31, Nov 30 or Dec 1?).  Daylight
Savings doesn't help (even if I subtract an exact multiple of days,
there are cases where a timezone could cause a multiple of 24 hours to
bypass a 23-hour day or get trapped by a 25-hour day).  You are best off
trying to start from a middle of a month to guarantee that even with the
fuzz you still land in the desired destination.

$ date --date="$(date "+%b 15") -6 month" +%b%Y
Apr2013
$ date --date="$(date "+%b 15") -7 month" +%b%Y
Mar2013
$ date --date="$(date "+%b 15") -8 month" +%b%Y
Feb2013
$ date --date="$(date "+%b 15") -9 month" +%b%Y
Jan2013

As such, I'm closing this as not a bug, although you may feel free to
add further comments.

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

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Nov 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 265 days ago.

Previous Next


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