• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1DATE(1)                     General Commands Manual                    DATE(1)
2
3NAME
4       date - show and set date and time
5
6SYNOPSIS
7       date [ -u ] [ -c ] [ -r seconds ] [ +format ] [ [yyyy]mmddhhmm[yy][.ss]
8       ]
9
10DESCRIPTION
11       The date command without arguments writes the date and time to the
12       standard output in the form
13                            Wed Mar  8 14:54:40 EST 1989
14       with EST replaced by the local time zone's abbreviation (or by the
15       abbreviation for the time zone specified in the TZ environment variable
16       if set).  The exact output format depends on the locale.
17
18       If a command-line argument starts with a plus sign ("+"), the rest of
19       the argument is used as a format that controls what appears in the
20       output.  In the format, when a percent sign ("%" appears, it and the
21       character after it are not output, but rather identify part of the date
22       or time to be output in a particular way (or identify a special
23       character to output):
24
25             Sample output                 Explanation
26         %a  Wed                           Abbreviated weekday name*
27         %A  Wednesday                     Full weekday name*
28         %b  Mar                           Abbreviated month name*
29         %B  March                         Full month name*
30         %c  Wed Mar 08 14:54:40 1989      Date and time*
31         %C  19                            Century
32         %d  08                            Day of month (always two digits)
33         %D  03/08/89                      Month/day/year (eight characters)
34         %e   8                            Day of month (leading zero blanked)
35         %h  Mar                           Abbreviated month name*
36         %H  14                            24-hour-clock hour (two digits)
37         %I  02                            12-hour-clock hour (two digits)
38         %j  067                           Julian day number (three digits)
39         %k   2                            12-hour-clock hour (leading zero blanked)
40         %l  14                            24-hour-clock hour (leading zero blanked)
41         %m  03                            Month number (two digits)
42         %M  54                            Minute (two digits)
43         %n  \n                            newline character
44         %p  PM                            AM/PM designation
45         %r  02:54:40 PM                   Hour:minute:second AM/PM designation
46         %R  14:54                         Hour:minute
47         %S  40                            Second (two digits)
48         %t  \t                            tab character
49         %T  14:54:40                      Hour:minute:second
50         %U  10                            Sunday-based week number (two digits)
51         %w  3                             Day number (one digit, Sunday is 0)
52         %W  10                            Monday-based week number (two digits)
53         %x  03/08/89                      Date*
54         %X  14:54:40                      Time*
55         %y  89                            Last two digits of year
56         %Y  1989                          Year in full
57         %z  -0500                         Numeric time zone
58         %Z  EST                           Time zone abbreviation
59         %+  Wed Mar  8 14:54:40 EST 1989  Default output format*
60       * The exact output depends on the locale.
61
62       If a character other than one of those shown above appears after a
63       percent sign in the format, that following character is output.  All
64       other characters in the format are copied unchanged to the output; a
65       newline character is always added at the end of the output.
66
67       In Sunday-based week numbering, the first Sunday of the year begins
68       week 1; days preceding it are part of "week 0".  In Monday-based week
69       numbering, the first Monday of the year begins week 1.
70
71       To set the date, use a command line argument with one of the following
72       forms:
73         1454         24-hour-clock hours (first two digits) and minutes
74         081454       Month day (first two digits), hours, and minutes
75         03081454     Month (two digits, January is 01), month day, hours, minutes
76         8903081454   Year, month, month day, hours, minutes
77         0308145489   Month, month day, hours, minutes, year
78                      (on System V-compatible systems)
79         030814541989 Month, month day, hours, minutes, four-digit year
80         198903081454 Four-digit year, month, month day, hours, minutes
81       If the century, year, month, or month day is not given, the current
82       value is used.  Any of the above forms may be followed by a period and
83       two digits that give the seconds part of the new time; if no seconds
84       are given, zero is assumed.
85
86       These options are available:
87
88       -u or -c
89              Use Universal Time when setting and showing the date and time.
90
91       -r seconds
92              Output the date that corresponds to seconds past the epoch of
93              1970-01-01 00:00:00 UTC, where seconds should be an integer,
94              either decimal, octal (leading 0), or hexadecimal (leading 0x),
95              preceded by an optional sign.
96
97FILES
98       /etc/localtime                  local timezone file
99       /usr/lib/locale/L/LC_TIME       description of time locale L
100       /usr/share/zoneinfo             timezone information directory
101       /usr/share/zoneinfo/posixrules  used with POSIX-style TZ's
102       /usr/share/zoneinfo/GMT         for UTC leap seconds
103
104       If /usr/share/zoneinfo/GMT is absent, UTC leap seconds are loaded from
105       /usr/share/zoneinfo/posixrules.
106
107                                                                       DATE(1)
108