2 .\" Copyright 2011 Nexenta Systems, Inc. All rights reserved.
3 .\" Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
4 .\" Copyright 1989 AT&T
5 .\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved
6 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
7 .\" http://www.opengroup.org/bookstore/.
8 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
9 .\" This notice shall appear on any product containing this material.
10 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
11 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
13 .TH DATE 1 "May 1, 2011"
15 date \- write the date and time
19 \fB/usr/bin/date\fR [\fB-u\fR] [\fB-R\fR] [+\fIformat\fR]
24 \fB/usr/bin/date\fR [\fB-a\fR [-]\fIsss.fff\fR]
29 \fB/usr/bin/date\fR [\fB-u\fR] [ [\fImmdd\fR] \fIHHMM\fR | \fImmddHHMM\fR [\fIcc\fR] \fIyy\fR] [\fI\&.SS\fR]
34 \fB/usr/xpg4/bin/date\fR [\fB-u\fR] [\fB-R\fR] [+\fIformat\fR]
39 \fB/usr/xpg4/bin/date\fR [\fB-a\fR [-]\fIsss.fff\fR]
44 \fB/usr/xpg4/bin/date\fR [\fB-u\fR]
45 [ [\fImmdd\fR] \fIHHMM\fR | \fImmddHHMM\fR [\fIcc\fR] \fIyy\fR] [\fI\&.SS\fR]
51 The \fBdate\fR utility writes the date and time to standard output or attempts
52 to set the system date and time. By default, the current date and time is
56 Specifications of native language translations of month and weekday names are
57 supported. The month and weekday names used for a language are based on the
58 locale specified by the environment variable \fBLC_TIME\fR. See
62 The following is the default form for the "C" locale:
66 \fI%a %b %e %T %Z %Y\fR
76 Fri Dec 23 10:10:42 EST 1988
84 The following options are supported:
88 \fB\fB-a\fR [\|\fB-\fR\|]\|\fIsss.fff\fR \fR
91 Slowly adjust the time by \fIsss\fR.\fIfff\fR seconds (\fIfff\fR represents
92 fractions of a second). This adjustment can be positive or negative. The
93 system's clock is sped up or slowed down until it has drifted by the number of
94 seconds specified. Only the super-user may adjust the time.
103 Display (or set) the date in Greenwich Mean Time (GMT\(emuniversal time),
104 bypassing the normal conversion to (or from) local time.
113 Change the default format to the format used for mail message headers
114 (similar to RFC 822 format). The default format becomes
118 \fI%a, %d %h %Y %H:%M:%S %z\fR
126 The following operands are supported:
130 \fB\fB+\fR\fIformat\fR \fR
133 If the argument begins with \fB+\fR, the output of \fBdate\fR is the result of
134 passing \fIformat\fR and the current time to \fBstrftime()\fR. \fBdate\fR uses
135 the conversion specifications listed on the \fBstrftime\fR(3C) manual page,
136 with the conversion specification for \fB%C\fR determined by whether
137 \fB/usr/bin/date\fR or \fB/usr/xpg4/bin/date\fR is used:
141 \fB\fB/usr/bin/date\fR \fR
144 Locale's date and time representation. This is the default output for
151 \fB\fB/usr/xpg4/bin/date\fR \fR
154 Century (a year divided by 100 and truncated to an integer) as a decimal number
158 In addition, the nonstandard conversion specification \fB%N\fR is also
159 supported, and is converted to the zero-padded number of nanoseconds since the
160 last second. Note that the actual resolution of this number is limited to the
161 resolution of the system's \fBCLOCK_REALTIME\fR clock. See
162 \fBclock_gettime\fR(3C).
164 The string is always terminated with a NEWLINE. An argument containing blanks
165 must be quoted; see the EXAMPLES section.
183 Day number in the month
192 Hour number (24 hour system)
219 Century (a year divided by 100 and truncated to an integer) as a decimal number
220 [00-99]. For example, \fIcc\fR is \fB19\fR for the year 1988 and \fB20\fR for
230 Last two digits of the year number. If century (\fIcc\fR) is not specified,
231 then values in the range \fB69-99\fR shall refer to years 1969 to 1999
232 inclusive, and values in the range \fB00-68\fR shall refer to years 2000 to
238 The month, day, year number, and century may be omitted; the current values are
239 applied as defaults. For example, the following entry:
243 example% \fBdate 10080045\fR
250 sets the date to Oct 8, 12:45 a.m. The current year is the default because no
251 year is supplied. The system operates in GMT. \fBdate\fR takes care of the
252 conversion to and from local standard and daylight time. Only the super-user
253 may change the date. After successfully setting the date and time, \fBdate\fR
254 displays the new date according to the default format. The \fBdate\fR command
255 uses \fBTZ\fR to determine the correct time zone information; see
259 \fBExample 1 \fRGenerating Output
262 The following command:
267 example% \fBdate '+DATE: %m/%d/%y%nTIME:%H:%M:%S'\fR
287 \fBExample 2 \fRSetting the Current Time
290 The following command sets the current time to \fB12:34:56\fR:
295 example# \fBdate 1234.56\fR
301 \fBExample 3 \fRSetting Another Time and Date in Greenwich Mean Time
304 The following command sets the date to January 1st, 12:30 am, 2000:
309 example# \fBdate -u 010100302000\fR
316 This is displayed as:
321 Thu Jan 01 00:30:00 GMT 2000
326 .SH ENVIRONMENT VARIABLES
329 See \fBenviron\fR(5) for descriptions of the following environment variables
330 that affect the execution of \fBdate\fR: \fBLANG\fR, \fBLC_ALL\fR,
331 \fBLC_CTYPE\fR, \fBLC_TIME\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
338 Determine the timezone in which the time and date are written, unless the
339 \fB-u\fR option is specified. If the \fBTZ\fR variable is not set and the
340 \fB-u\fR is not specified, the system default timezone is used.
346 The following exit values are returned:
353 Successful completion.
368 See \fBattributes\fR(5) for descriptions of the following attributes:
377 ATTRIBUTE TYPE ATTRIBUTE VALUE
382 .SS "/usr/xpg4/bin/date"
390 ATTRIBUTE TYPE ATTRIBUTE VALUE
394 Interface Stability Standard
400 \fBstrftime\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
405 \fB\fBno permission\fR \fR
408 You are not the super-user and you tried to change the date.
414 \fB\fBbad conversion\fR \fR
417 The date set is syntactically incorrect.
423 If you attempt to set the current date to one of the dates that the standard
424 and alternate time zones change (for example, the date that daylight time is
425 starting or ending), and you attempt to set the time to a time in the interval
426 between the end of standard time and the beginning of the alternate time (or
427 the end of the alternate time and the beginning of standard time), the results
431 Using the \fBdate\fR command from within windowing environments to change the
432 date can lead to unpredictable results and is unsafe. It can also be unsafe in
433 the multi-user mode, that is, outside of a windowing system, if the date is
434 changed rapidly back and forth. The recommended method of changing the date
435 is '\fBdate\fR \fB-a\fR'.
438 Setting the system time or allowing the system time to progress beyond
439 \fB03:14:07 UTC Jan 19, 2038\fR is not supported on Solaris.