.TH CHGDATE 1
.SH NAME
chgdate \- print result of date modification commands
.SH SYNOPSIS
.B chgdate
[
.B -n
]  
[
.B date
[
.B date_modifier_list
] ]
.br
[
.B modified_date
\ \ 
.B -
\ \ 
.B modified_date
]
.SH DESCRIPTION
.B Chgdate 
wraps the 
.B getdate(3) 
function for use by the shell.
It passes the command line to 
.B getdate(3),
which parses the first word(s) of the command string 
to obtain a 'start date', 
and then applies an optional 
list of date modification instructions.
The result, in one of several formats, is written to stdout.
Alternatively, if the command line contains the 'minus' (
.B -
) binary operator, 
the result is the number of days difference between two dates.
No argument or the argument 'now' or 'today' returns today's date.
.B Chgdate
can be used to interconvert Julian and Gregorian dates,
because either form of the date can be given
as input,
and both forms are included in the output.
.PP
Syntax for a date is relatively loose:
.sp
.in +5
{ 
.B now 
| 
.B today 
| 
.B weekday 
| 
.B "month day[, year]" 
|
.B mm/dd[/yy]
|
.B "{month|mm} number weekday"
|
.B julian_day
} 
.in
.sp
For example, 'Thu', 'thu', 'THURSDAY', and 'thursday' are equivalent.
Also, 'Mar 19, 1988', 3.19.88 and '3/19/88', or for the current year,
\'mar 19', 3.19 and '3/19'.
A weekday can be given variously, e.g., 
as 'Mon', 'mo', monday', etc.
It is converted into the date corresponding to that day for
the current week.
For this conversion, we assume the current week started on sunday.
A sufficiently large number is understood as a Julian date.
.PP
A date modification sequence
consists of two arguments: an optionally signed number
and either a units specification or a weekday:
.sp
.in +5
{
.B [\+|\-]number
\ \ \ {
.B units
|
.B weekday
} }
.in
.sp
The number-weekday sequence returns the
.B number-th
weekday of the month;
the number-units sequence increments the date by
the product of number x units.
The actions of a list of date modification sequences are cumulative.
.PP
The units specification is a one-letter or full-word identifier:
.sp
.in +5
{
.B d[ay]
|
.B w[eek]
|
.B m[onth]
|
.B y[ear]
}
.in
.sp
A weekday can be given as the first two or three letters of the
weekday, or as the full word.
.PP
For the particular case of a number-weekday sequence,
the date can be given by a single preceding identifier or number, 
corresponding to the month.
.PP
Command line options for the format of the output of  
.B getdate
are:
.sp
.in +5
\fB-0	Mon dd[, yyyy]\fP
.sp
\fB-1	Mon dd, yyyy (Wdayname) julian_day\fP
.sp
\fB-2	mm:dd:yyyy:wdaynumber:julian_day\fP
.sp
\fB-3	Mon:dd:yyyy:Wdayname:julian_day\fP
.sp
\fB-4	julian_day\fP
.in -5
.PP
Chgdate returns the date in format '1' as the default;
.SH EXAMPLES
.nf
.in +5
$ chgdate now
Apr 25, 1989 (Tue) 2447642
.sp
$ chgdate now 1 y 1 m 1 w 1 d
Jun 02, 1990 (Sat) 2448045
.sp
$ chgdate now 1 y 1 m 1 w 1 d - now
403
.sp
$ chgdate fri
Apr 28, 1989 (Fri) 2447645
.sp
$ chgdate -3 6 3 mon
Jun	19	1989	Mon	2447697
.sp
$ chgdate -2 1/1/70
1	1	1970	4	2440588
.in
.fi
.SH "SEE ALSO"
getdate(3)
.SH AUTHOR
John  Rupley, Tucson, AZ  85716
.br
rupley@u.arizona.edu
