GNU bug report logs - #17161
date: confusing: "TIME -/+NUM" treated as time zone

Previous Next

Package: coreutils;

Reported by: "Marc R.J. Brevoort" <mrjb <at> dnd.utwente.nl>

Date: Tue, 1 Apr 2014 15:51:04 UTC

Severity: wishlist

Full log


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

From: "Marc R.J. Brevoort" <mrjb <at> dnd.utwente.nl>
To: bug-coreutils <at> gnu.org
Subject: Bug in date arithmetic of date
Date: Tue, 1 Apr 2014 13:30:16 +0200 (CEST)
Hi,

There seems to be some weirdness in date arithmetic when dates
include a time stamp (and all provided in ISO formatting):

Correct:

mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11" +"%Y-%m-%d %H:%M:%S"
2014-03-11 00:00:00

mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-10 00:00:00

Incorrect:

mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11 12:34 -2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 15:34:00
mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11 12:34 +2 hours" +"%Y-%m-%d 
%H:%M:%S"
2014-03-11 11:34:00
mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11 12:34 -1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 13:34:00
mrjb <at> THE-D-MRJB:~$ date -d "2014-03-11 12:34 +1 day" +"%Y-%m-%d %H:%M:%S"
2014-03-12 11:34:00





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

Previous Next


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