date Versions 5.96 and 5.97 (at least) have a bug when passing dates
that are greater than the actual number of days in a month. Previous
versions (most of the machines seem to have 5.2.1) would convert the
date to a correct date. For instance date -d20060229 would provide data
for March 1.
I use this in scripts that I pass a date to as a parameter:
let NEXT_DAY=$1+1
NEXT_DATE=`date -d$NEXT_DAY +%Y%m%d`
and:
let PREV_DAY=$1-1
PREV_DATE=`date -d$PREV_DAY +%Y%m%d`
In this case it might do: date -d20060200 which would turn into Jan 31.
Maybe this is an undocumented feature that someone thought was a bug.
In my case it is very useful .
Since this isn't working I figured there must be another way to do this
so I started playing around and found:
date -d"20060228 + 1 day"
and this does do what I want. However:
date -d"20060201 - 1 day"
does not work. It reports Feb 2.
Steve
--
______________________________________________________________________
Steve Cousins, Ocean Modeling Group Email: [EMAIL PROTECTED]
Marine Sciences, 452 Aubert Hall http://rocky.umeoce.maine.edu
Univ. of Maine, Orono, ME 04469 Phone: (207) 581-4302
_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils