GNU bug report logs - #26101
Counterproductive calculation order in date

Previous Next

Package: coreutils;

Reported by: Ulf Zibis <Ulf.Zibis <at> gmx.de>

Date: Wed, 15 Mar 2017 00:42:01 UTC

Severity: normal

Tags: notabug

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ulf Zibis <Ulf.Zibis <at> gmx.de>
To: Pádraig Brady <P <at> draigBrady.com>, Eric Blake <eblake <at> redhat.com>, 26101 <at> debbugs.gnu.org
Subject: bug#26101: Counterproductive calculation order in date
Date: Thu, 16 Mar 2017 00:27:50 +0100
[Message part 1 (text/plain, inline)]
Am 15.03.2017 um 16:53 schrieb Pádraig Brady:
>  "coreutils FAQ"

By the way, I think there is a typo:

$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B.'
Last month was June.

$ date --date="$(date +%Y-%m-15) +1 month" +'Next month will be %B.'
Next month will be May.

Compared with:

$ thismonth=$(date --date="@$now" "+%Y-%m-15 12:00")
$ echo "LastMonth=$(date -d "$thismonth 1 month ago" +%B), NextMonth=$(date -d "$thismonth 1 month" +%B)."
LastMonth=March, NextMonth=May.

I assume, in the first example, it should be:

Last month was *March*.


-Ulf

[Message part 2 (text/html, inline)]
[smime.p7s (application/pkcs7-signature, attachment)]

This bug report was last modified 6 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.