[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11115: linux date arithmetic

From: Assaf Gordon
Subject: bug#11115: linux date arithmetic
Date: Mon, 15 Oct 2018 10:40:01 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

tags 11115 notabug
close 11115

(triaging old bugs)


On 28/03/12 06:39 AM, Stefan Karamuz wrote:
Please check the 2 linux commands:

date -d "$(date +%F\ %H:%M:%S)" +%F\ %H:%M:%S
date -d "$(date +%F\ %H:%M:%S) + 1 minute" +%F\ %H:%M:%S

It's very confusing, because the results of the two commands differ in one hour and one minute, except of one minute only.

In version 8.26 (released 2016) date gained the "--debug"
option which can help in understanding such issues.
The "+1" is taken to be "UTC+1" time zone, as shown here:

$ date --debug -d "$(date +%F\ %H:%M:%S)" +%F\ %H:%M:%S
  date: parsed date part: (Y-M-D) 2018-10-15
  date: parsed time part: 10:35:21
  date: input timezone: system default

$ date --debug -d "$(date +%F\ %H:%M:%S) + 1 minute" +%F\ %H:%M:%S
  date: parsed date part: (Y-M-D) 2018-10-15
  date: parsed time part: 10:35:27 UTC+01
  date: parsed relative part: +1 minutes
  date: input timezone: parsed date/time string (+01)

I'm closing this bug, but discussion can continue by replying to this thread.

 - assaf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]