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. _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
