1, modify the Linux time can try the date command
The function of the date command is to display and set the system time and date.
Enter date to view the current system time:
2. Date of modification:
The order of the time set to September 6, 2015 is as follows:
#date –s 09/06/2015
3. Modification Time:
The command to set the system time to 16:12 is as follows:
#date –s 16:12:00
4. Modify Time zone:
Locate the appropriate time zone file/usr/share/zoneinfo/asia/shanghai replace the current/etc/localtime.
To modify the contents of the/etc/sysconfig/clock file:
#vi/etc/sysconfig/clock
Zone= "Asia/shanghai"
Utc=false
Arc=false
5. Sync bios Time:
Synchronize the BIOS clock and force the system time to be written to the CMOS command as follows:
#clock –w
6, the modification time needs
date– function Character Modification content
The meanings of each of the options in the command are:
-D datestr,--Date DATESTR Displays the dates described by datestr
-S DATESTR,--set DATESTR sets the date described by datestr
-u,--universal Display or set Universal Time
7. Time Domain
%h hours (00). 23)
%i hours (01). 12)
%k hours (0). 23)
%l hours (1). 12)
%m points (00.. 59)
%p Show AM or PM
%r time (Hh:mm:ss am or PM), 12 hours
%s from January 1, 1970 00:00:00 to the number of seconds currently experienced
%s seconds (00). 59)
%t time (Hh:mm:ss am or PM), 12 hours
%x Display time format (%h:%m:%s)
%z Time zone Date field
%a full name of the week
%a the full name of the week (Sunday. Saturday)
%b month abbreviation (Jan. DEC)
%b Month full name (January. December)
%c Date and time (Mon Nov 8 14:12:46 CST 1999)
%d one months of the day (01). 31)
%d Date (MM/DD/YY)
%h and%b options are the same
%j the first day of the year (001. 366)
%m month (01). 12)
%w Day of the week one (0 for Sunday)
%w the first few weeks of the year (00. 53, Monday for first day)
%x format for displaying dates (MM/DD/YY)
The last two digits of the%y year (1999 is 99)
%y year (ex: 1970,1996, etc.)
In particular, only the superuser can set the time with the date command, and the average user can only display the time with the date command.
Example 1: Displays the time in the specified format.
$date ' +this date now is =>%x,time =>%x, thank! '
This date is =>11/12/99,time are now =>17:53:01, thank!
Example 2: Displays the current time in a predetermined format.
#date
Fri Nov 15:20:18 CST 1999
Example 3: Set time is 14:36 P.M.
#date-S 14:36:00
Fri Nov 14:15:00 CST 1999
Example 4: Set time is November 28, 1999
#date –s 991128
Sun Nov 00:00:00 CST 1999
Example: Set time is August 8, 2008 12:00
#date –s "2008-08-08 12:00:00"
After modifying, remember to enter: Clock-w
Write system time to CMOS
Linux modifies system time