The time to modify Linux can be modified by using the Date Directive: The command for the time set to May 10, 2009 is as follows: #date-S 05/10/2009 modified: The command to set the system time to 10:18 A.M. 0 seconds is as follows. #date-S 10:18:00 modify time zone: Find the appropriate time zone file ...
Time to modify Linux can use the date directive
Date Modified:
The order of the time set to May 10, 2009 is as follows:
#date-S 05/10/2009
Modification Time:
The command to set the system time to 10:18 A.M. 0 seconds is as follows.
#date-S 10:18:00
To modify the time zone:
Locate the appropriate time zone file/usr/share/zoneinfo/asia/shanghai replace the current/etc/localtime.
Modify the contents of the/etc/sysconfig/clock file as:
Zone= "Asia/shanghai"
Utc=false
Arc=false
Sync BIOS Time:
Synchronize the BIOS clock and force the system time to be written to the CMOS command as follows:
#clock-W
The function of the date command is to display and set the system date and time.
Enter date to view the current system time.
Modify time requires date-Functional character modified content
The meanings of each of the options in the command are:
-D datestr,--date DATESTR displays the date described by datestr
-S Datestr,--set datestr Set the date of the DATESTR description
-U,--universal display or set Universal Time
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 (24-hour system) (HH:MM:SS)
%x shows the format of Time (%h:%m:%s)
%Z Time zone Date field
%a the abbreviation for the day of the week (Sun. Sat)
%A the full name of the week (Sunday. Saturday)
%b month abbreviation (Jan. DEC)
Full name of%B month (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 ' is =>%x, time was now =>%x, thank! '
This date is =>11/12/99, and time is 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: Setting time Wei 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