Get the week's day

Hi All,
I have the below requirement ,
if i give the week number for ex 41 i need to get the date for Monday and thursday for this given week. my expected output is 13/10/2014 (Monday's date) and 16/10/2014 (Thursday's date)
I am using GNU LINUX .
Pls help me with your thoughts.
Thanks in advance.

With linux, GNU date should be available, so sth like this might help:

date -d "-$(($(date +"%u")-1)) days" +"%d/%m/%Y"
13/10/2014

I think that mohanalakshmi wanted to give it a week number as input (41 in the example) and get the days from that rather that just "What are Monday & Thursday this week"

Let me have a think........:confused:

OK, try

week=39
date -d"-$(($(date +"%u - 1 + 7*(%W - $week)"))) days" +"%d/%m/%Y"
29/09/2014
3 Likes

Ha, you beat me to it! Wonderful! :wink:

It even works for week=0 giving Monday as 31/12/2013

:cool:

Robin

... which I think should be 30/12/2013 , and which, in fact (after testing), it does deliver ...

Oops, my excitement got the better of me in typing a response. I agree that it does give the correct date.

:o

Above doesn't work into the future; this should:

date -d"$(((-1) * ($(date +"%u - 4 + 7*(%V - $week)"))))days" +"%d/%m/%Y"