[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug in date-command
From: |
Bob Proulx |
Subject: |
Re: bug in date-command |
Date: |
Fri, 13 Mar 2009 15:03:01 -0600 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Bas Mijling wrote:
> I use the date command to find the next day of a date written in the
> 'yyyymmdd' format,
> e.g. for 25 October 2008
Just a side note: I like using %F for this type of string.
> This works perfect for all dates I used so far, apart from a (strangely
> enough) 20081026
> date -d "20081026 1 days" +%Y%m%d
> returns the same datecode: 20081026
You probably want to do the date calculation at noon to avoid problems
near time change since one day is really 24 hours. And working in UTC
is safer.
Try these:
date -u -d "2008-10-26 12:00 UTC +1 days" +%Y%m%d
date -u -d "20081026 12:00 +0000 1 days" +%Y%m%d
Please also see this FAQ item as you may be experiencing one of the
problems described there.
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
And the documentation here:
info coreutils "General date syntax"
Bob