--- src/bin/date/date.1 2003/06/17 04:22:49 1.2 +++ src/bin/date/date.1 2005/07/20 06:10:51 1.3 @@ -34,7 +34,7 @@ .\" .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD: src/bin/date/date.1,v 1.34.2.15 2003/02/24 03:01:00 trhodes Exp $ -.\" $DragonFly: src/bin/date/date.1,v 1.1 2003/06/15 23:44:59 dillon Exp $ +.\" $DragonFly$ .\" .Dd November 17, 1993 .Dt DATE 1 @@ -220,6 +220,22 @@ When the date is adjusted to a specific the resulting timezone will be set so that the date matches the earlier of the two times. .Pp +Adjusting the date by months is inherently ambiguous because +a month is a unit of variable length depending on the current date. +This kind of date adjustment is applied in the most intuitive way. +First of all, +.Nm +tries to preserve the day of the month. +If it is impossible because the target month is shorter than the present one, +the last day of the target month will be the result. +For example, using +.Fl v No +1m +on May 31 will adjust the date to June 30, while using the same option +on January 30 will result in the date adjusted to the last day of February. +This approach is also believed to make the most sense for shell scripting. +Nevertheless, be aware that going forth and back by the same number of +months may take you to a different date. +.Pp Refer to the examples below for further details. .El .Pp @@ -296,6 +312,12 @@ will display the last day of February in .Pp .Dl "Tue Feb 29 03:18:00 GMT 2000" .Pp +So will do the command: +.Pp +.Dl "date -v30d -v3m -v0y -v-1m" +.Pp +because there is no such date as the 30th of February. +.Pp The command: .Pp .Dl "date -v1d -v+1m -v-1d -v-fri"