Index of Section 1 Manual Pages
| Interix / SUA | date.1 | Interix / SUA |
DATE(1) System General Commands Manual DATE(1)
NAME
date - display or set date and time
SYNOPSIS
date [-ajnu] [-d dst] [-r seconds] [-t minutes_west] [+format]
[mmddHHMM[[cc]yy]]
date -b [-ajnu] [-d dst] [-r seconds] [-t minutes_west] [+format]
[[[[[[cc]yy]mm]dd]HH]MM[.SS]]
DESCRIPTION
When invoked without arguments, the date utility displays the current
date and time. Otherwise, depending on the options specified, date will
set the date and time or print it in a user-defined way.
Only a user with appropriate permissions may set the date.
The options are as follows:
-a Use the adjtime(2) call to gradually skew the local time to the
remote time rather than just hopping. Note: On Interix this
option remains valid, but the adjtime call is not supported.
Hence the option will error.
-b, ---bsd-format
The supplied date is in a BSD-style format instead of the POSIX
standard format ( [mmddHHMM[[cc]yy]] ). With the BSD-style format
only the minutes (MM) are required and the rest are optional
which can be faster and more convenient at times. The optional
specifiction order is: [[[[[[cc]yy]mm]dd]HH]MM[.SS]] which also
matches other international date standards better.
-d dst Set the system's value for Daylight Saving Time. If dst is non-
zero, future calls to gettimeofday(2) will return a non-zero
value for tz_dsttime.
-j, --test
Test the date format but do not apply the change. The tested date
is still displayed in the requested format.
-n By default, if the timed(8) daemon is running, date sets the time
on all of the machines in the local group. The -n option sup-
presses this behavior and causes the time to be set only on the
current machine.
-r seconds
Print out (in specified format) the date and time represented by
seconds from the Epoch.
-t minutes_west
Set the system's value for minutes west of GMT. minutes_west
specifies the number of minutes returned in tz_minuteswest by
future calls to gettimeofday(2).
-u, --utc, --universal
Display or set the date in UTC (Coordinated Universal) time.
An operand with a leading plus sign (`+') signals a user-defined format
string which specifies the format in which to display the date and time.
The format string may contain any of the conversion specifications
described in the strftime(3) manual page, as well as any arbitrary text.
A newline (`\n') character is always output after the characters speci-
fied by the format string. The format string for the default display is:
%a %b %e %H:%M:%S %Z %Y
If an operand does not have a leading plus sign, it is interpreted as a
value for setting the system's notion of the current date and time. The
canonical representation for setting the date and time is:
yy Year in abbreviated form (for years 1969-2068). The format
ccyymmddHHMM is also permitted, for non-ambiguous years.
mm Numeric month, a number from 1 to 12.
dd Day, a number from 1 to 31.
HH Hour, a number from 0 to 23.
MM Minute, a number from 0 to 59.
SS Second, a number from 0 to 61 (59 plus a maximum of two
leap seconds).
Everything but the minute is optional with the -b option (BSD-style for-
mat). With the default format (POSIX standard) the month, day, hour and
minutes are required with the century and year being optional.
Time changes for Daylight Saving Time, standard time, leap seconds, and
leap years are handled automatically.
ENVIRONMENT
TZ The timezone to use when displaying dates. See environ(7) for
more information.
FILES
/var/log/messages record of the user setting the time
EXAMPLES
The following command:
$ date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S"
displays:
DATE: 1987-11-21
TIME: 13:36:16
Set the date to June 12, 2009, 4:10 AM (POSIX style):
# date 061204102009
Set the date to December 25, 11:00 AM without changing the year:
# date 12251100
Set the date to June 13, 1985, 4:27 PM (BSD-style):
# date -b 8506131627
Set the time to 2:32 PM, without modifying the date:
# date -b 1432
DIAGNOSTICS
Exit status is 0 on success, 1 if unable to set the date, and 2 if able
to set the local date, but unable to set it globally.
Occasionally, when timed(8) synchronizes the time on many hosts, the set-
ting of a new time value may require more than a few seconds. On these
occasions, date prints: ``Network time being set''. The message
``Communication error with timed'' occurs when the communication between
date and timed(8) fails.
SEE ALSO
gettimeofday(2), mktime(3), strftime(3), ntpd(8), rdate(8), timed(8)
R. Gusella and S. Zatti, TSP: The Time Synchronization Protocol for UNIX
4.3BSD.
STANDARDS
The date utility is compatible with IEEE Std 1003.2 (``POSIX.2'') and
SUS.
HISTORY
A date command appeared in Version 1 AT&T UNIX.
NOTES
Users will need to have been granted SE_SYSTEMTIME_PRIVILEGE the permis-
sion needed in order to adjust the time. Typically the Administrator
account and accounts in the Administrators group have this permission but
it can be granted to other accounts.
The range of dates that can be set are limited to the the range allowable
by the mktime(3) function.
Interix June 12, 2009 Interix