|
From: | Colin S. Miller |
Subject: | Re: date/getdate.y: Relative days |
Date: | Sun, 04 Mar 2007 22:57:50 +0000 |
User-agent: | Icedove 1.5.0.9 (X11/20061220) |
Akim Demaille wrote:
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.
Akim, %u (numerical-day-of-week) is useful here This should work DATE="10 august 2007" # a random date OFFSET=$(( $(date --date="${DATE}" +%u ) - 1)) date --date="$DATE $OFFSET days ago" HTH, Colin S. Miller BTW, The first week (before the week's start day), can be week 0 in some systems.
[Prev in Thread] | Current Thread | [Next in Thread] |