bug-coreutils
[Top][All Lists]
Advanced

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

bug#9283: date increment failure for 2011-10-30


From: Eric Blake
Subject: bug#9283: date increment failure for 2011-10-30
Date: Thu, 11 Aug 2011 10:48:38 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.11

tag 9283 notabug
thanks

On 08/11/2011 04:52 AM, address@hidden wrote:
Here's what I found adding +1 days to a 2011-10-30
(BTW this is not a problem for any other date I tried)

Thanks for the report. However, this is not a bug, but a consequence of daylight savings in your current choice of timezone. This is a FAQ:

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

fut=$(date -d"2011-10-30" '+%F') ;
echo $fut
2011-10-30


fut=$(date -d"$fut +1 days" '+%F') ;
echo $fut
2011-10-30

Adding 24 hours to midnight on a day with 25 hours still results in the same day, explaining your results. The FAQ details several options for avoiding the issue, such as fixing your calculations to UTC (which does not have daylight savings) or basing your computations relative to noon instead of midnight (since both a computed 11am and 1pm still fall in the right day, if your relative computation was affected by a daylight savings adjustment).

This transmission has been issued by a member of the HSBC Group

Employer disclaimers cannot be enforced on publicly archived lists; it is considered better netiquette to send mail from private email accounts that will not append unenforceable text.

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org





reply via email to

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