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 "Oct 25, 2017"
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]
30 [ [\fImmdd\fR] \fIHHMM\fR | \fImmddHHMM\fR [\fIcc\fR] \fIyy\fR] [\fI\&.SS\fR]
36 The \fBdate\fR utility writes the date and time to standard output or attempts
37 to set the system date and time. By default, the current date and time is
41 Specifications of native language translations of month and weekday names are
42 supported. The month and weekday names used for a language are based on the
43 locale specified by the environment variable \fBLC_TIME\fR. See
47 The following is the default form for the "C" locale:
51 \fI%a %b %e %T %Z %Y\fR
61 Fri Dec 23 10:10:42 EST 1988
69 The following options are supported:
73 \fB\fB-a\fR [\|\fB-\fR\|]\|\fIsss.fff\fR \fR
76 Slowly adjust the time by \fIsss\fR.\fIfff\fR seconds (\fIfff\fR represents
77 fractions of a second). This adjustment can be positive or negative. The
78 system's clock is sped up or slowed down until it has drifted by the number of
79 seconds specified. Only the super-user may adjust the time.
88 Display (or set) the date in Greenwich Mean Time (GMT\(emuniversal time),
89 bypassing the normal conversion to (or from) local time.
98 Change the default format to the format used for mail message headers
99 (similar to RFC 822 format). The default format becomes
103 \fI%a, %d %h %Y %H:%M:%S %z\fR
111 The following operands are supported:
115 \fB\fB+\fR\fIformat\fR \fR
118 If the argument begins with \fB+\fR, the output of \fBdate\fR is the result of
119 passing \fIformat\fR and the current time to \fBstrftime()\fR. \fBdate\fR uses
120 the conversion specifications listed on the \fBstrftime\fR(3C) manual page.
121 Next conversion specification for \fB%C\fR is used:
127 Century (a year divided by 100 and truncated to an integer) as a decimal number
131 In addition, the nonstandard conversion specification \fB%N\fR is also
132 supported, and is converted to the zero-padded number of nanoseconds since the
133 last second. Note that the actual resolution of this number is limited to the
134 resolution of the system's \fBCLOCK_REALTIME\fR clock. See
135 \fBclock_gettime\fR(3C).
137 The string is always terminated with a NEWLINE. An argument containing blanks
138 must be quoted; see the EXAMPLES section.
156 Day number in the month
165 Hour number (24 hour system)
192 Century (a year divided by 100 and truncated to an integer) as a decimal number
193 [00-99]. For example, \fIcc\fR is \fB19\fR for the year 1988 and \fB20\fR for
203 Last two digits of the year number. If century (\fIcc\fR) is not specified,
204 then values in the range \fB69-99\fR shall refer to years 1969 to 1999
205 inclusive, and values in the range \fB00-68\fR shall refer to years 2000 to
211 The month, day, year number, and century may be omitted; the current values are
212 applied as defaults. For example, the following entry:
216 example% \fBdate 10080045\fR
223 sets the date to Oct 8, 12:45 a.m. The current year is the default because no
224 year is supplied. The system operates in GMT. \fBdate\fR takes care of the
225 conversion to and from local standard and daylight time. Only the super-user
226 may change the date. After successfully setting the date and time, \fBdate\fR
227 displays the new date according to the default format. The \fBdate\fR command
228 uses \fBTZ\fR to determine the correct time zone information; see
232 \fBExample 1 \fRGenerating Output
235 The following command:
240 example% \fBdate '+DATE: %m/%d/%y%nTIME:%H:%M:%S'\fR
260 \fBExample 2 \fRSetting the Current Time
263 The following command sets the current time to \fB12:34:56\fR:
268 example# \fBdate 1234.56\fR
274 \fBExample 3 \fRSetting Another Time and Date in Greenwich Mean Time
277 The following command sets the date to January 1st, 12:30 am, 2000:
282 example# \fBdate -u 010100302000\fR
289 This is displayed as:
294 Thu Jan 01 00:30:00 GMT 2000
299 .SH ENVIRONMENT VARIABLES
302 See \fBenviron\fR(5) for descriptions of the following environment variables
303 that affect the execution of \fBdate\fR: \fBLANG\fR, \fBLC_ALL\fR,
304 \fBLC_CTYPE\fR, \fBLC_TIME\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
311 Determine the timezone in which the time and date are written, unless the
312 \fB-u\fR option is specified. If the \fBTZ\fR variable is not set and the
313 \fB-u\fR is not specified, the system default timezone is used.
319 The following exit values are returned:
326 Successful completion.
341 See \fBattributes\fR(5) for descriptions of the following attributes:
350 ATTRIBUTE TYPE ATTRIBUTE VALUE
354 Interface Stability Standard
360 \fBstrftime\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), \fBstandards\fR(5)
365 \fB\fBno permission\fR \fR
368 You are not the super-user and you tried to change the date.
374 \fB\fBbad conversion\fR \fR
377 The date set is syntactically incorrect.
383 If you attempt to set the current date to one of the dates that the standard
384 and alternate time zones change (for example, the date that daylight time is
385 starting or ending), and you attempt to set the time to a time in the interval
386 between the end of standard time and the beginning of the alternate time (or
387 the end of the alternate time and the beginning of standard time), the results
391 Using the \fBdate\fR command from within windowing environments to change the
392 date can lead to unpredictable results and is unsafe. It can also be unsafe in
393 the multi-user mode, that is, outside of a windowing system, if the date is
394 changed rapidly back and forth. The recommended method of changing the date
395 is '\fBdate\fR \fB-a\fR'.
398 Setting the system time or allowing the system time to progress beyond
399 \fB03:14:07 UTC Jan 19, 2038\fR is not supported on Solaris.