COHERENT manpages

This page displays the COHERENT manpage for date [Print/set the date and time].

List of available manpages
Index


date -- Command

Print/set the date and time
date [-s] [-u] [[yymmdd]hhmm[.ss]]

date sets or prints prints the date and time of day.

If invoked without an argument, date  prints the current date and time.  It
looks for  the environmental variable TIMEZONE,  which specifies local time
zone and  daylight saving time  information.  For details on  the format of
this variable, see the Lexicon entries for TIMEZONE and ctime().

If invoked  with a  numeric argument  (that is, one  that consists  of just
digits,  with  no prefix),  date  interprets that  argument  as giving  the
current date  and time, and  uses it to  set the current  system time.  The
string must have the format yymmddhhmm[ss]; the  fields must be  defined as
follows:

    yy    Year (00-99)
    mm    Month (01-12)
    dd    Day (01-31)
    hh    Hour (00-23)
    mm    Minute (00-59)
    ss    Seconds (00-59)

For example, typing

    date 940612141233

sets the date  to June 12, 1994, and the  time to 2:12:33 P.M.  At least hh
and mm must be specified --  the rest are optional.  date will complain and
refuse to change  the time should you attempt to  set an impossible date or
time, e.g., the date to February 30 or the time to 25 o'clock.

Note  that  the COHERENT  command  ATclock  returns the  date  and time  as
recorded by your computer's internal  clock.  To reset the time as COHERENT
understands  it  to the  time  as  your computer  understands  it, use  the
command:

    date `/etc/ATclock`

If  you use  option -s  on date's  command line, date  does not  convert to
daylight savings time when it sets the time.

If you use option -u on  date's command line, date sets and prints the date
and time in Greenwich Mean Time (GMT) rather than in your local time.

See Also

ATclock,
commands,
ctime(),
printf(),
time,
TIMEZONE

Notes

Only the superuser root can change the system's date or time.

The COHERENT version  of the date command differs from  the UNIX version in
that the last two fields of its output are reversed.  For example, the UNIX
output of date reads

    Sun Jan 13 12:02:09 CST 1991

where the COHERENT output reads:

    Sun Jan 13 12:02:09 1991 CST

This may be important when importing UNIX shell commands into COHERENT.