bug-coreutils
[Top][All Lists]
Advanced

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

Re: date: next sunday is this sunday?


From: Pádraig Brady
Subject: Re: date: next sunday is this sunday?
Date: Mon, 24 Sep 2007 10:57:18 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20070919)

Martin Bernreuther wrote:
> Hello,
> 
> if I invoke date, e.g.
> 
> ~> date
> So 23. Sep 20:33:39 CEST 2007
> 
> and especially using a relative date
> with "next" and a weekday, like
> 
> ~> date --date="next sunday"
> So 23. Sep 00:00:00 CEST 2007
> 
> I don't get the next sunday, but this sunday  (today)
> on a sunday, whereas it works for every other day.
> This was done with
> ~> date --version
> date (GNU coreutils) 6.4

This happens for every day actually.

"next sunday" seems to mean starting at today,
return the date for the first "sunday" encountered.
"this" and "next" seem to be synonymous in this context.

Now this is at least confusing because "last sunday" does
in fact move back a week, which is not symmetric.
Also the info page is contradicting:

"In this context, 'last DAY' or 'next DAY' is also acceptable;
they move one week before or after the day that DAY by itself would
represent."

> and also with version 5.2.1. For the latter
> ~> date --date="tomorrow next sunday"
> seems to give me the expected result,
> but not for 6.4, where this is handled like
> "tomorrow" alone.

I can confirm this. This looks like a definite bug
as the info page says that the relative specifiers
are cumulative. The older date command did
add in the order specified, whereas with the newer one,
one can't change the origin date.

> If this is not a bug, how can I get the *next* sunday?

You could try the following script:
http://www.pixelbeat.org/scripts/day
which you can use like:

./day mon
./day mon week
./day mon last

p.s.

In the info page I would include a link
to the "Date input formats" node from
the "date invocation" node.




reply via email to

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