DATE(1,C) AIX Commands Reference DATE(1,C)
-------------------------------------------------------------------------------
date
PURPOSE
Displays or sets the date.
SYNTAX
Operating with Superuser Authority
+--------+ +------------------------+ +----------------+
date ---| +----+ |---| +---------------+ |-- mm --|1 +------+ |---|
+-| -n |-+ +-| +------+ 1|- hh -+ +- .ss -|1 |-+
^| -u || +-| 1|- dd -+ +- yy -+
|+----+| +- MM -+
+------+
+--------+ +---------------------------------+ +-------+
date ---| +----+ |---| +------------------------+ |--- mm ---| |---|
+-| -n |-+ +-| +---------------+ |- hh -+ +- .ss -+
^| -u || +-| +------+ |- dd -+
|+----+| +-| |- MM -+
+------+ +- yy -+
Operating without Superuser Authority
+------+ +--------------+
date ---| |---| |---|
+- -u -+ +- + "string" -+
-----------------
1 Do not put a blank between these items.
DESCRIPTION
Warning: Do not change the date while the system is running with more than one
user.
If called with no flags or with a flag list that begins with a + (plus sign),
the date command writes the current date and time to standard output.
Otherwise, it sets the current date. Only a user operating with superuser
authority can change the date and time. The ordering of the day and month
numbers in the date specification is locale-specific. The default orders are
MMddhhmm.ssyy and yyMMddhhmm.ss where:
Processed November 8, 1990 DATE(1,C) 1
DATE(1,C) AIX Commands Reference DATE(1,C)
o MM is the month number
o dd is the number of the day in the month
o hh is the hour in the day (using a 24-hour clock)
o mm is the minute number
o .ss is the number of seconds
o yy is the last two numbers of the year.
The alternative orderings are ddMMhhmm.ssyy, and yyddMMhhmm.ss.
Notes:
1. If the format yyMMddhhmm.ss is specified, the value of yy must be 88 to
99.
2. When the .ssyy format is used, if yy is specified as less than 70, the
next century is assumed. For example, 32 is interpreted as 2032.
3. When the alternate formats are used, if the month is specified, the day
must also be specified.
The current month, day, hour, and year are default values. The system operates
in Greenwich Mean Time (GMT). The date command takes care of the conversion to
and from local standard and daylight time as specified in the TZ environmental
variable. For more information see the environment miscellaneous facility in
the AIX Operating System Technical Reference.
Note: The date command is needed to set the clock correctly on a PS/2 after a
time change.
When the system administrator uses the date command to set the time or date
from any machine on a TCP/IP network which is using the time daemon
(/etc/timed), the date is reset on all machines in the network. The time
daemon on one machine in a network runs as the master and all others as slaves.
The master performs the task of computing clock differences and sends
correction values to the slaves. If the date command is set on a machine in a
slave state, it notifies the master of the needed change. For information on
the function of time daemons, see the timed command in the AIX TCP/IP Guide.
If you follow date with a + and a string containing field descriptors, 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 the output without change. The date command always ends
the string with a new-line character. Output fields are fixed size (zero
padded if necessary).
FLAGS
-n Do not set the time globally on all machines in a local area network
that have their clocks synchronized.
Processed November 8, 1990 DATE(1,C) 2
DATE(1,C) AIX Commands Reference DATE(1,C)
-u Display/set time in GMT.
FIELD DESCRIPTORS
a Displays the abbreviated day of the week ("Sun" to "Sat" or the
non-English equivalent).
d Displays the day of month ("01" to "31").
D Displays the date as mm/dd/yy (the default) or as dd/mm/yy. This format
is locale-specific.
h Displays the abbreviated month ("Jan" to "Dec" or the non-English
equivalent).
H Displays the hour ("00" to "23").
j Displays the day of year ("001" to "366").
m Displays the month of year ("01" to "12").
M Displays the minute ("00" to "59")
n Inserts a new-line character.
r Displays the time in AM/PM notation (or the non-English equivalent).
S Displays the second ("00" to "59").
t Inserts a tab character.
T Displays the time as hh:mm:ss (the default) or as mm:hh:ss. This format
is locale-specific.
w Displays the day of the week numerically (Sunday = "0").
y Displays the last two numbers of year ("00" to "99").
EXAMPLES
1. To display current date and time:
date
2. To set the date and time:
date 02171425.45
This command 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:
Processed November 8, 1990 DATE(1,C) 3
DATE(1,C) AIX Commands Reference DATE(1,C)
date +"%r %a %d %h %y (Julian Date: %j)"
This command displays the date (assume current year is 1984) shown in
Example 2 as:
02:25:03 PM Fri 17 Feb 84 (Julian Date: 048)
FILES
/dev/kmem Default system image file.
RELATED INFORMATION
See the time, stime, and strftime system calls and the environment
miscellaneous facility in AIX Operating System Technical Reference.
See the timed command in the AIX TCP/IP User's Guide.
See "Introduction to International Character Support" in Managing the AIX
Operating System.
Processed November 8, 1990 DATE(1,C) 4