help-gnu-utils
[Top][All Lists]
Advanced

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

date/getdate.y: Relative days


From: Akim Demaille
Subject: date/getdate.y: Relative days
Date: Mon, 12 Feb 2007 11:49:42 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (gnu/linux)

I'm trying to find a means, given a week number, to find the date of
the Monday and Friday.  I was wondering if I could use GNU date to do
that straightforwardly instead of having to program this.

One first problem is how to get the n-th week of the year.  The
following seems to work:

  % LC_ALL=C date -d '2007-01-01 7 weeks'
  Mon Feb 19 00:00:00 CET 2007

but actually, it does not necessarily point to a Monday:

  % LC_ALL=C date -d '2006-01-01 7 weeks'
  Sun Feb 19 00:00:00 CET 2006



Then, the second issue, is how to use something like "next Friday", or
"last Monday" relatively to a date.

  % LC_ALL=C date -d '2006-01-01 next friday'
  Sun Jan  1 00:00:00 CET 2006
  (silently ignoring the "next Friday" part).

  % LC_ALL=C date -d 'next friday after 2006-01-01'
  date: invalid date `next friday after 2006-01-01'

Thanks in advance!




reply via email to

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