Noticed problems with command date: [apavenis@callisto Test]$ ./date-test.sh + date Thu Aug 9 10:16:31 EEST 2012 + date -d '2 weeks ago' Thu Jul 26 10:16:31 EEST 2012 + date -d 'thursday 2 weeks ago' Thu Jul 26 00:00:00 EEST 2012 + date -d 'next month' Sun Sep 9 10:16:31 EEST 2012 + date -d '1 monday next month' Thu Sep 13 00:00:00 EEST 2012 + date -d '2 monday next month' Thu Sep 20 00:00:00 EEST 2012
As one can see: 1) specifying both week day (eg. thursday) and week the actual date is taken from week next to specified week. It should perhaps be inside the specified week. The same happens if one uses 'this week', 'next week' etc. 2) specifying month and for example first monday generates date not from the begin of the month but uses the day in current month as reference Andris