CentOS display settings Time Command – date

Format:

date [OPTION] … [+ FORMAT]
date [-u | –utc | –universal] [. MMDDhhmm [[CC] YY] [ss]]

Parameters:

-d STRING: displays the date described by the STRING
-s STRING: STRING described by the set date

% Y year (example: 1970,2009, etc.)
% Y last two digits of year (1988 88)
% M month (01..12)
% D day of month (01..31)
% H hour (00..23)
% I hour (01..12)
% K Hour (0..23)
% L Hour (1..12)
% P AM or PM shows
% M minute (00..59)
% S second (00..59)

% R Time (hh: mm: ss AM or PM), 12 小时
% T time (24 hour clock) (hh: mm: ss)
% X time display format (% H:% M:% S)
% X display format (mm / dd / yy) Date
% D date (mm / dd / yy)
% S of seconds from January 1, 1970 00:00:00 to the current experience

Commonly used on these, the rest of the Direct man like a …

 

 

Examples:

1, at noon today there is a very special time, 2009-0807 12:34:56, use the following format can be displayed 12/34/56/7/8/9 this format. The “-” you can ignore the first “0.”

date + ‘% I /% M /% S /% – d /% – m /% – y’

2, set the date to 20,090,807, 00:00

date -s 20090807

3, set the time, does not change the date

date -s 16:02:23

4. Set the date and time

date -s “20090807 16:02:23”

5, see the specific time 100 days and 5 hours ago

date -d “-1 day 5 hour” + “% Y-% m-% d% H:% M:% S”

6, check the time after 100 minutes

date -d “+100 min” + “% Y-% m-% d% H:% M:% S”

7, calculate the timestamp

date -d 20090528 +% s

8, reducing the time stamp

date -d “1970-01-01 1243440000 sec GMT” + “% F% T”

9, use the online update system time NTP protocol

ntpdate 210.72.145.44