HPUX date[1]






 date(1)                                                             date(1)





 NAME
      date - print or set the date and time

 SYNOPSIS
      date [-u]
      date [-u] +format
      date [-u] mmddhhmm[yy]

 DESCRIPTION
      date displays or sets the current HP-UX system clock date and time.
      The command has three forms:

           date [-u]           Display the current date and time.

           date [-u] +format   Display current date and time according to
                               formatting directives specified in format
                               (see Formatting Directives below).

                               The format string consists of zero or more
                               directives and ordinary characters.  A
                               directive consists of a % character, an
                               optional field width and precision
                               specification, and a terminating character
                               that determines the directive's behavior.
                               All ordinary characters are copied unchanged
                               into the output string, and the output string
                               is always terminated with a new-line
                               character.

                               The default format string is %c when format
                               is not specified or the date [-u] command
                               form is used.

           date [-u] mmddhhmm[yy]
                               Set HP-UX system clock to the date and time
                               specified.  Requires super-user privilege.
                               If -u option is given, the specified date and
                               time is assumed to be Universal Coordinated
                               Time.  The numeric argument is interpreted
                               left-to-right as follows:

                                  mm     Month number.

                                  dd     Day number in the month.

                                  hh     Hour number (24 hour system).

                                  mm     Minute number.

                                  yy     (optional) Last 2 digits of the
                                         year number.  If not specified,



 Hewlett-Packard Company            - 1 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





                                         current year is used.

    Options
           -u                  If this option is given, all operations occur
                               as if the TZ environment variable were set to
                               Coordinated Universal Time (UTC).

      The HP-UX system operates in Coordinated Universal Time (UTC).  date
      automatically converts to and from local standard and daylight time
      unless the -u option is given (see Environment Variables below).

      If the super-user attempts to set the date backwards, date generates a
      warning, and requires an extra confirmation before proceeding.

      When date is used to set the date, a pair of date change records is
      written to the file /etc/wtmp.

      In an HP Clustered Environment, the date and time are automatically
      set when the system comes up as a cluster node.  Setting the date and
      time from any node in a cluster sets the date and time on all nodes in
      the cluster.

    Formatting Directives
      The following directives, shown without the optional field width and
      precision specification, are replaced by the indicated characters:

           %a        Abbreviated weekday name.

           %A        Full weekday name.

           %b        Abbreviated month name.

           %B        Full month name.

           %c        Current date and time representation.

           %C        Century (a year divided by 100 and truncated to an
                     integer) as a decimal number (00-99).

           %d        Day of the month as a decimal number [01,31].

           %D        Date in the format mm/dd/yy.

           %e        Day of the month as a decimal number (1-31 in a two
                     digit field with leading space-character fill).

           %E        Combined Emperor/Era name and year.

           %h        Same as %b.





 Hewlett-Packard Company            - 2 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





           %H        Hour (24-hour clock) as a decimal number [00,23].

           %I        Hour (12-hour clock) as a decimal number [01,12].

           %j        Day of the year as a decimal number [001,366].

           %m        Month as a decimal number [01,12].

           %M        Minute as a decimal number [00,59].

           %n        New-line character.

           %N        Emperor/Era name.

           %o        Emperor/Era year.

           %p        Equivalent of either AM or PM.

           %r        12-hour clock time (01-12) using AM/PM notation.

           %S        Second as a decimal number [00,59].

           %t        Tab character.

           %u        Weekday as a decimal number [1(Monday),7].

           %U        Week number of the year (Sunday as the first day of the
                     week) as a decimal number [00,53].  All days in a new
                     year preceding the first Sunday are considered to be in
                     week 0.

           %V        Week of the year (Monday as the first day of the week)
                     as a decimal number [01,53].  If the week containing 1
                     January has four or more days in the new year, it is
                     considered week 1; otherwise, it is week 53 of the
                     previous year, and the next week is week 1.

           %w        Weekday as a decimal number [0(Sunday),6].

           %W        Week number of the year (Monday as the first day of the
                     week) as a decimal number [00,53].  All days in a new
                     year preceding the first Sunday are considered to be in
                     week 0.

           %x        Current date representation.

           %X        Current time representation.

           %y        Year without century as a decimal number [00,99].





 Hewlett-Packard Company            - 3 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





           %Y        Year with century as a decimal number.

           %Z        Time zone name (or no characters if time zone cannot be
                     determined).

           %%        %

      The following directives are provided for backward compatibility.  It
      is recommended that the preceding directives be used in preference to
      those which follow.

           %D        Date in usual U.S.  Format (%m/%d/%y) (use %x instead).

           %F        Full month name (use %B instead).

           %h        Abbreviated month name (use %b instead).

           %r        Time in 12-hour US format (%I:%M:%S [AM|PM]) (use %X
                     instead).

           %T        Time in 24-hour US format (%H:%M:%S) (use %X instead).

           %z        Time zone name (or no characters if time zone cannot be
                     determined) (use %Z instead).

      If a directive is not one of the above, the behavior is undefined.

    Modified Formatting Directives
      Some Formatting Directives can be modified by the E and O modifier
      characters to indicate a different format or specification as
      specified in the LC_TIME environment variable.  If the corresponding
      keyword (see era, era_year, era_d_fmt, and alt_digits) is not
      specified or not supported, the unmodified field descriptor value is
      used.

           %EC       The name of the base year in alternate representation.

           %Ex       Alternate date representation.

           %Ey       Offset from %EC (year only) in the alternate
                     representation.

           %Od       Day of month using the alternate numeric symbols.

           %Oe       Day of month using the alternate numeric symobols with
                     leading space-character fill if applicable.

           %OH       Hour (24 hour clock) using the alternate numeric
                     symbols.





 Hewlett-Packard Company            - 4 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





           %OI       Hour (12 hour clock) using the alternate numeric
                     symbols.

           %Om       Month using the alternate numeric symbols.

           %OM       Minutes using the alternate numeric symbols.

           %OS       Seconds using the alternate numeric symbols.

           %OU       Week number of the year (Sunday as the first day of the
                     week) using the alternate numeric symbols.

           %Ow       Weekday as number using the alternate representation
                     (Sunday = 0).

           %OW       Weekday number of the year (Monday as the first day of
                     the week) using the alternate numeric symbols.

           %Oy       Year (offset from %C) in alternate representation.

    Field Width and Precision
      An optional field width and precision specification can immediately
      follow the initial % of a directive in the following order:

      [-|0]w    the decimal digit string w specifies a minimum field width
                in which the result of the conversion is right- or left-
                justified.  Default is right-justified (with space padding).
                If the optional - option is specified, the result is left-
                justified with space padding on the right.  If the optional
                0 option is specified, the result is right-justified and
                padded with zeros on the left.

      .p        the decimal digit string p specifies the minimum number of
                digits to appear for the d, H, I, j, m, M, o, S, U, w, W, y,
                and Y directives, and the maximum number of characters to be
                used from the a, A, b, B, c, D, E, F, h, n, N, p, r, t, T,
                x, X, z, Z, and % directives.  In the first case, if a
                directive supplies fewer digits than specified by the
                precision, it is expanded with leading zeros.  In the second
                case, if a directive supplies more characters than specified
                by the precision, excess characters are truncated on the
                right.

      If no field width or precision is specified for a d, H, I, m, M, S, U,
      W, y, or j directive, a default of .2 is used for all except j for
      which .3 is used.

 EXTERNAL INFLUENCES
    Environment Variables
      TZ determines the conversion between the system time in UTC and the
      time in the user's local time zone (see environ(5) and tztab(4)).  TZ



 Hewlett-Packard Company            - 5 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





      also determines the content (that is, the time-zone name produced by
      the %z and %Z directives) of date and time strings output by the date
      command.

      If TZ is not set in the environment or is set to the empty string, a
      default of EST5EDT is used.

      LC_TIME determines the content (for example, weekday names produced by
      the %a directive) and format (for example, current time representation
      produced by the %X directive) of date and time strings output by the
      date command.

      LC_CTYPE determines the interpretation of the bytes within the format
      string as single and/or multi-byte characters.

      LC_NUMERIC determines the characters used to form numbers for those
      directives that produce numbers in the output.  The characters used
      are those defined by ALT_DIGITS (see langinfo(5)).

      LANG determines the language in which messages (other than the date
      and time strings) are displayed.

      If LC_TIME or LC_CTYPE is not specified in the environment or is set
      to the empty string, the value of LANG is used as a default for each
      unspecified or empty variable.  If LANG is not specified or is set to
      the empty string, a default of "C" (see lang(5)) is used instead of
      LANG.  If any internationalization variable contains an invalid
      setting, date behaves as if all internationalization variables are set
      to "C".  See environ(5).

    International Code Set Support
      Single- and multi-byte character code sets are supported.

 DIAGNOSTICS
      no permission                      Super-user privileges are required
                                         to change the date.

      bad conversion                     Date specification is syntactically
                                         incorrect.

      bad format character               Field directive is not
                                         recognizable.

 EXAMPLES
    Set Date
      Set date to Oct 8, 12:45 AM:

           date 10080045

    Display Formatted Date
      Display current date and time using a specified format:



 Hewlett-Packard Company            - 6 -     HP-UX Release 9.0: August 1992






 date(1)                                                             date(1)





           date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'

      Output resembles the following:

           DATE: 10/08/87
           TIME: 12:45:05

    Display Formatted Date Using Local Language
      Using the date as set in the first example above and LC_TIME set to
      german:

           date '%-4.4h %2.1d %H:%M'

      generates output similar to:

           Okt   8 12:45

      where the month field is four bytes long, flush-left, and space-padded
      on the right if the month name is shorter than four bytes.  The day
      field is two bytes long, with leading zeros suppressed.

 WARNINGS
      Changing the date while the system is running in multi-user mode
      should be avoided to prevent disrupting user-scheduled and time-
      sensitive programs and processes.  Also, changing the date can cause
      make and the SCCS and cron subsystems to behave in an unexpected
      manner.  The cron daemon should be killed prior to setting the date
      backwards, then restarted (see cron(1M)).  SCCS files should be
      checked with val if deltas have been made while the clock was set
      wrong (see val(1)).

      Former HP-UX format option A has been changed to W for ANSI
      compatability.

 AUTHOR
      date was developed by AT&T and HP.

 FILES
      /etc/wtmp

 SEE ALSO
      stime(2), ctime(3C), getdate(3C), strftime(3C), tztab(4), environ(5),
      lang(5), langinfo(5).

 STANDARDS CONFORMANCE
      date: SVID2, XPG2, XPG3, POSIX.2








 Hewlett-Packard Company            - 7 -     HP-UX Release 9.0: August 1992