[pooh doc]$ date --version
date (GNU sh-utils) 2.0
Written by David MacKenzie.

Above as included with RedHat v6.2 distribution. I just ran across
something interesting I thought maybe someone could help me with. I
checked the man page, and info page but have been unable to find any
additional references. 

I've written a shell script that determines the 2nd Thurs of the next
month (so I can email meeting notices in a timely fashion). My calculations
work great, for the current year. where I ran into a problem was when
asking 'date' to return information based on a 'specified' year.

The least complicated examples:
I started my test here since I wanted to make sure that the script
would work properly going into next year so I tested the following:

[pooh doc]$ date +%w --date "jan 1 2001"
6
The first day of Jan is a Saturday for the year 2000. Wrong answer.

[pooh doc]$ date +%w --date "jan 1 2000"
6
Obviously correct.

[pooh doc]$ date +%w --date "jan 1 next year"
1
Correct. Expected this when specifying '2001'.

[pooh doc]$ date +%w --date "jan 1 this year"
1
We don't recognize 'this year' correctly?

[pooh doc]$ date +%w --date "jan 1 "
6
Current year assumed.

Did I miss something somewhere??
-----------------------------------------------------
Sue Bauer-Lee          |    KE4HNN
PO Box 2900            |    
Lilburn, GA 30048      |    Email: [EMAIL PROTECTED]
-----------------------------------------------------

Reply via email to