[Top][All Lists]

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

Re: errors on date

From: Alan Curry
Subject: Re: errors on date
Date: Thu, 26 Nov 2009 19:50:54 -0500 (GMT+5)

=?ISO-8859-1?Q?P=E1draig_Brady?= writes:
> David Gonzalez Marquez wrote:
> > Hi!
> > 
> > I am student of computer science at university of Buenos Aires. I am
> > using the command "date" for calculing days. I need to calculate the
> > following day for any day. Doing that I see a error.
> > 
> > I use for example: date --date "1920-05-02 1 days" "+%F"
> > 
> > and for the followings days, I see a error:
> > 
> > date: invalid date `1920-05-01 1 days'
> Seems to work fine here with coreutils 7.2 and 8.1
> What version of date are you using?

The dates in question are timezone transitions (mostly daylight savings
time, but the first one was a transition from old-fashioned local time to a
modern time zone).

date is filling in 00:00:00 since no specific time was specified, and trying
to find the time_t corresponding to 1920-05-01 00:00:00 and it fails because
that time never existed in Buenos Aires. It never gets as far as trying to
add the "1 days".

In Argentina, the jump forward happens at 00:00:00 (according to my reading
of the tzdata file), so if you use 12:00:00 you should be safe for any day.

$ TZ=America/Buenos_Aires date --date "1920-05-01 12:00:00 1 days" "+%F"

Alan Curry

reply via email to

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