1. The date command is used by the Linux system to display the time and set the system date, and its usage format is: date [option] [+format]
The options are:
(1) -d,--date=STRING means to display the time described by the string.
like:
(2) -f,--file=DATEFILE means to read the time data line by line from the file and display them.
like:
(3) -I[FMT],--iso-8601[=FMT] means output date/time in ISO 8601 format.
like:
(4) -R,--rfc-2822 means output date and time in RFC 2822 format.
like:
(5) -r,reference=FILE means to display the last modification time of the file FILE
like:
(6) -s, --set=STRING means setting the time described by the string STRING
Note that modifying the system time requires root privileges
The formats are:
%%literal%
%a locale's abbreviated weekday name (for example, Sun)
%A locale's full weekday name (for example, Sunday)
%b locale's abbreviated month name (for example, Jan)
%B locale's Full month name (e.g., January)
%c Date and time of locale (e.g., Thu Mar 3 23:05:25 2005)
%C century; like %Y, except the last two digits are omitted (e.g., 20
) %d day of month (eg, 01)
%D date; same as %m/%d/%y
%e day of month, blank-padded; same as %_d
%F full date; same as %Y-% m-%d same as
%g ISO week number last two digits of year (see %G)
%G year of ISO week number (see %V); normally only useful for %V %
h same as %b
%H hour ( 00..23)
%I hours (01..12)
%j days of the year (001..366)
%k hours, space filled (0..23); same as %_H
%l hours, space filled (1..12); same as %_I
%m month (01..12)
%M minute (00..59)
%n newline
%N nanosecond (000000000..999999999)
%p locale equivalent to AM or PM; blank if unknown
%P like %p, but lowercase
%r locale's 12-hour clock time (for example, 11:11:04 PM)
%R 24-hour format hours and minutes; same as %H:%M
%s seconds since 1970-01-01 00:00:00 UTC %
S seconds (00..60)
%t a label
%T time; same as %H:% M: %S same
%u day of week (1..7); 1 is Monday
%U week number of year with Sunday as first day of week (00..53)
%V ISO week number with Monday as The first day of the week (01..53)
%w the day of the week (0..6); 0 is Sunday
%W the week number of the year, with Monday as the first day of the week (00..53)
%x language locale's date representation (eg 12/31/99)
%X locale's time representation (eg 23:13:48)
%y last two digits of year (00..99)
%Y year
%z +hhmm digit Time zone (e.g. -0400)
%:z +hh:mm Numeric time zone (e.g. -04:00)
%::z +hh:mm:ss Numeric time zone (e.g. -04:00:00)
%::: z Numeric time zone with : to necessary precision (e.g. -04, +05:30)
%Z letter time zone abbreviation (eg EDT)
Examples are as follows:
format display time