date(1)								      date(1)



NAME
  date - Displays or sets the date

SYNOPSIS

  Without Superuser Authority - Displays the Date


  date [-u] [+field_descriptor ...]

  With Superuser Authority - Sets the Date


  date [-nu] [MMddhhmm.ssyy | alternate_date_format] [+field_descriptor ...]

DESCRIPTION

  The date command displays the date and, with superuser authority, sets the
  system date.

  Displaying the Date

  The date command writes the current date and time to standard output if
  called with no flags or with a flag list that begins with a + (plus sign).

  The current month, day, hour, and year are default values.  The system
  operates in Coordinated Universal Time (UTC).

  If you follow date with a + (plus sign) and a field descriptor, you can
  control the output of the command.  You must precede each field descriptor
  with a % (percent sign).  The system replaces the field descriptor with the
  specified value.  Enter a literal % as %%.  The date command copies any
  other characters to standard output without change. The date command always
  ends the string with a newline character.  Output fields are fixed size
  (zero padded if necessary).

  The date command prints out a usage message on any unrecognized flags or
  input.

  Field Descriptors


  a   Displays the locale's abbreviated weekday name (Sun to Sat or the non-
      English equivalent).

  A   Displays the locale's full weekday name.

  b   Displays the locale's abbreviated month name.

  B   Displays the locale's full month name.

  c   Displays the locale's appropriate time and date representation.

  C   Displays the locale's century (the year divided by 100 and truncated to
      an integer) as a decimal number (00 to 99).

  d   Displays the day of month as a decimal number (01 to 31).

  D   Displays the date in the format mm/dd/yy (the default), or as specified
      by the LC_TIME environment variable, if defined.

  e   Displays the day of the month as a decimal number (1 to 31 in a 2-digit
      field with leading space fill).

  Ec  Specifies the name of the base year (period) in the locale's alterna-
      tive representation.

  EC  Specifies the name of the base year (period) in the locale's alterna-
      tive representation.

  Ex  Specifies the locale's alternative date representation.

  Ey  Specifies the offset from %EC (year only) in the locale's alternative
      representation.

  EY  Specifies the full alternative year representation.

  h   A synonym for %b.

  H   Displays the hour as a decimal number (00 to 23).

  I   Displays the hour as a decimal number (01 to 12).

  j   Displays the day of year as a decimal number (001 to 366).

  m   Displays the month of year as a decimal number (01 to 12).

  M   Displays the minute as a decimal number (00 to 59).

  n   Inserts a newline character.

  N   Represents the alternative era name.

  o   Represents the alternative era year.

  Od  Specifies the day of the month using the locale's alternative numeric
      symbols.

  Oe  Specifies the day of the month using the locale's alternative numeric
      symbols.

  OH  Specifies the hour (24-hour clock) using the locale's alternative
      numeric symbols.

  OI  Specifies the hour (12-hour clock) using the locale's alternative
      numeric symbols.

  Om  Specifies the month using the locale's alternative numeric symbols.

  OM  Specifies the inutes using the locale's alternative numeric symbols.

  OS  Specifies the seconds using the locale's alternative numeric symbols.

  OU  Specifies the week number of the year (Sunday as the first day of the
      week) using the locale's alternative numeric symbols.

  Ow  Specifies the weekday as a number in the locale's alternative represen-
      tation (Sunday = 0).

  OW  Specifies the week number of the year (Monday as the first day of the
      week) using the locale's alternative numeric symbols.

  Oy  Specifies the year (offset from %C) in alternative representation.

  p   Displays the locale's equivalent of either AM or PM.

  r   Displays the time (12-hour clock) using AM/PM notation (or the non-
      English equivalent) in the format hh:mm:ss AM or hh:mm:ss PM.

  S   Displays the second as a decimal number (00 to 61).

  t   Inserts a tab character.

  T   Displays the time in 24-hour clock format as hh:mm:ss (the default), or
      as specified by the LC_TIME environment variable, if defined.

  u   Displays the weekday as a decimal number [1,7], with 1 representing
      Monday.

  U   Displays the week number of the year (Sunday is the first day of the
      week) as a decimal number (00 to 53).

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

  w   Displays the day of the week as a decimal number (Sunday = 0).

  W   Displays the week number of the year (Monday is the first day of the
      week) as a decimal number (00 to 53).

  x   Displays the locale's appropriate date representation.

  X   Displays the locale's appropriate time representation.

  y   Displays the last two numbers of the year as a decimal number (00 to
      99).

  Y   Displays the full year as a decimal number.

  Z   Displays the time zone name, or no characters if the time zone cannot
      be determined.

  %%  Inserts a % character.

  Setting the Date

  Only a user operating with superuser authority can change the date and
  time.	 The LC_TIME variable, if it is defined, controls the ordering of the
  day and month numbers in the date specification.  The default order is
  MMddhhmm.ssyy where:

    +  MM is the month number (01=January).

    +  dd is the number of the day in the month.

    +  hh is the hour in the day (using a 24-hour clock).

    +  mm is the minute number.

    +  ss is the number of seconds.

    +  yy is the last two numbers of the year.

  The alternative ordering is either ddMMhhmm.ssyy, yyMMddhhmm.ss, or
  yyddMMhhmm.ss.  If format yyMM...  is specified, the value of yy must be 88
  to 99.


  Reset the date in single-user mode only. Changing the date in multiuser
  mode could cause the creation and modifications dates for user files to be
  inconsistent.

  Note that to change the year, the system disk must be updated with the new
  year information. To change the year, in single-user mode enter the command

       mount -u /

  after you enter a date containing a new year. The mount -u / command writes
  the new year into the superblock on the system disk. Note also that the
  root filesystem is now mounted read/write.

FLAGS

  -n  Does not set the time globally on all machines in a local area network
      that have their clocks synchronized (superuser only).

  -u  Performs operations as if the TZ environment variable was set to the
      string GMT0.  Otherwise, date uses the time zone indicated by the TZ
      environment variable or the system default if that variable is not set.

EXAMPLES

   1.  To display current date and time, enter:
	    date


       Depending on your current locale, the output might look like one of
       the following:
	    Thu Apr 12	13:21:30 EDT  1992

	    jeu 12 avr	17:21:30 CUT  1992

	    tor 12 apr	17:21:30 CUT  1992


       The first output line is for an American English locale, the second is
       for a French locale, and the third is for a Danish locale.

   2.  To set the date and time, enter:
	    date  02171425.45


       This sets the date and time to 14:25:45 (45 seconds after 2:25 p.m.)
       February 17 of the current year.

   3.  To display the date and time in a specified format, enter:
	    date  +"%r	%d  %h	%y  (%a)"


       This displays the date (assume current year is 1993) shown in Example
       2 as:
	    02:25:03  PM  17  Feb  93  (Fri)


  Do not change the date while the system is running with more than one user.



RELATED INFORMATION

  Functions: gettimeofday(2), setclock(3), getclock(3).

  Command and Shell User's Guide.