bugGNU Core Utilities - Bugs: bug #19475, date produces incorrect output...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #19475: date produces incorrect output with +/-1 Month when the date is the 31st

Submitted by:  None
Submitted on:  Sat 31 Mar 2007 10:29:41 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Duplicate
Privacy: PublicAssigned to: None
Open/Closed: Closed

Sat 31 Mar 2007 11:10:24 PM UTC, comment #1:

Not a bug; but it is a duplicate of bug #18921. The manual specifically recommends the following (info coreutils relative):

The fuzz in units can cause problems with relative items. For
example, `2003-07-31 -1 month' might evaluate to 2003-07-01, because
2003-06-31 is an invalid date. To determine the previous month more
reliably, you can ask for the month before the 15th of the current
month. For example:

$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!

Eric Blake <ericb>
Project Administrator
Sat 31 Mar 2007 10:29:41 PM UTC, original submission:

# date --date='31 March 2006 +1 month'
Mon May 1 00:00:00 PDT 2006

# date --date='31 March 2006 -1 month'
Fri Mar 3 00:00:00 PST 2006

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ericb (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 31 Mar 2007 11:10:24 PM UTCericbStatusNone=>Duplicate
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1