Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Apropos / Subsearch:
optional field

DATE(1V)                                                              DATE(1V)

       date - display or set the date

       date [ -u ] [ -a [ - ] sss.fff ] [ yymmddhhmm [ .ss ] ]
            [ +format ]

       /usr/5bin/date [ -u ] [ -a [ - ] sss.fff ] [ mmddhhmm
            [ yy ] ] [ +format ]

       The  System  V  version  of this command is available with the System V
       software installation option.  Refer  to  for  information  on  how  to
       install optional software.

       If  no  argument  is given, or if the argument begins with +, date dis-
       plays the current date and time.  Otherwise, the current date  is  set.
       Only the super-user may set the date.

       yy  is  the last two digits of the year; the first mm is the month num-
       ber; dd is the day number in the month; hh is the hour number (24  hour
       system);  the  second mm is the minute number; .ss (optional) specifies
       seconds.  The year, month and day may be omitted;  the  current  values
       are supplied as defaults.

       If  the argument begins with +, the output of date is under the control
       of the user.  The format for the output is similar to that of the first
       argument  to  printf(3V).   All  output  fields are of fixed size (zero
       padded if necessary).  Each field descriptor is preceded by % and  will
       be  replaced  in  the output by its corresponding value.  A single % is
       encoded by %%.  All other characters are copied to the  output  without
       change.  The string is always terminated with a new-line character.

       Field Descriptors:
              n    insert a new-line character
              t    insert a tab character
              m    month of year - 01 to 12
              d    day of month - 01 to 31
              y    last 2 digits of year - 00 to 99
              D    date as mm/dd/yy
              H    hour - 00 to 23
              M    minute - 00 to 59
              S    second - 00 to 59
              T    time as HH:MM:SS
              j    day of year - 001 to 366
              w    day of week - Sunday = 0
              a    abbreviated weekday - Sun to Sat
              h    abbreviated month - Jan to Dec
              r    time in AM/PM notation

       When  setting the date, the first mm is the month number; dd is the day
       number in the month; hh is the hour number (24 hour system); the second
       mm is the minute number; yy is the last 2 digits of the year number and
       is optional.  The current year is the default if no year is mentioned.

       -u               Display the date in GMT (universal time).  The  system
                        operates  in GMT; date normally takes care of the con-
                        version to and from local standard and daylight  time.
                        -u may also be used to set GMT time.

       -a [-]sss.fff    Using  the  adjtime(2) system call, tell the system to
                        slowly adjust the time by sss.fff seconds (fff  repre-
                        sents  fractions of a second).  This adjustment can be
                        positive or negative.  The system's clock will be sped
                        up  or  slowed down until it has drifted by the number
                        of seconds specified.

              date 10080045

       Would set the date to Oct 8, 12:45 AM.

       If the year were 1986, and the date were so set,
              date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'

       would generate as output:

              DATE: 08/01/86
              TIME: 14:45:05

       /var/adm/wtmp       to record time-setting

                           timezone definitions

       adjtime(2), printf(3V), utmp(5V)

       date: Failed to set date: Not owner
              If you try to change the date but are not the super-user.

       date: bad format character
              If the field descriptor is not recognizable.

                               23 November 1987                       DATE(1V)