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


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to