Hello GNU date maintainer,

I came across an interesting "feature" in the "date" utility from sh-utils

I needed a way to get the year and week-number for a date a few days ago.
This produces some interesting results right now, when we are close to Jan
1st:

osiris:~ $ date
Mon Jan  6 14:05:20 CET 2003
osiris:~ $ date --date="today -5 days" +"%Y/w%V/"
2003/w01/
osiris:~ $ date --date="today -6 days" +"%Y/w%V/"
2002/w01/
osiris:~ $ date --date="today -1 week" +"%Y/w%V/"
2002/w01/

Note that the year changes from 2003 to 2002 simply by going back a single
day. This is wrong in some sense - Dec 31st 2002 belongs to the first week
of 2003, not the first week of 2002. On the other hand, the year when going
back 6 days from Jan 6th 2003 *is* 2002, so I understand why it behaves the
way it does.


This occurs with the date-program from Mandrake Linux 9 on Intel:

osiris:~ $ date --version
date (sh-utils) 2.0.15
Written by David MacKenzie.

and with a version of GNU date on Solaris 8:

root@wcd4u009:>gnudate --version
date (GNU sh-utils) 2.0
Written by David MacKenzie.


Regards,

Henrik St�rner <[EMAIL PROTECTED]>





_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to