tag 9283 notabug
thanks

On 08/11/2011 04:52 AM, [email protected] 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   [email protected]    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



Reply via email to