66 lines
2.1 KiB
Plaintext
66 lines
2.1 KiB
Plaintext
|
|
|
|
|
|
|
|
|
|
Command: date - print or set the date and time
|
|
Syntax: date [-qsu] [[MMDDYY]hhmm[ss]] [+format]
|
|
Flags: -q Read the date from stdin
|
|
-s Set the time (implicit for -q or a date string)
|
|
-u Print the date as GMT
|
|
-t Use this number of seconds instead of current time
|
|
Examples: date # Print the date and time
|
|
date 0221921610 # Set date to Feb 21, 1992 at 4:10
|
|
p.m.
|
|
|
|
With the -q flag or a numeric argument, date sets the GMT time and
|
|
date. MMDDYY refers to the month, day, and year; hhmmss refers to the
|
|
hour, minute and second. Each of the six fields must be exactly two
|
|
digits, no more and no less. date always display the date and time,
|
|
with the default format for the system. The -u flag request GMT time
|
|
instead of local time. A format may be specified with a + followed by a
|
|
printf-like string with the following options:
|
|
|
|
%% % character
|
|
%A Name of the day
|
|
%B Name of the month
|
|
%D mm/dd/yy
|
|
%H Decimal hour on 2 digits
|
|
%I Decimal hour modulo 12 on 2 digits
|
|
%M Decimal minute on 2 digits
|
|
%S Decimal seconds on 2 digits
|
|
%T HH:MM:SS
|
|
%U Decimal week number, Sunday being first day of week
|
|
%W Decimal week number, Monday being first day of week
|
|
%X Same as %T
|
|
%Y Decimal year on 4 digits
|
|
%Z Time Zone (if any)
|
|
%a Abbreviated name of the day
|
|
%b Abbreviated name of the month
|
|
%c Appropriate date & time (default format)
|
|
%d Decimal day of the month on 2 digits
|
|
%e Same as %d, but a space replaces leading 0
|
|
%h Same as %b
|
|
%j Decimal dey of the year on 3 digits
|
|
%m Decimal month on 2 digits
|
|
%n Newline character
|
|
%p AM or PM
|
|
%r 12-hour clock time with AM/PM
|
|
%s Number of seconds since the epoch
|
|
%t Tab character
|
|
%w Decimal day of the week (0=Sunday)
|
|
%x Same as %D
|
|
%y Decimal year on 2 digits
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|