Home > Article > Operation and Maintenance > What is the command to modify the system time in Linux?
The Linux command to modify the system time is "date". The function of the date command is to display or set the system date and time. The format is set to a plus sign followed by several marks. Different marks display differently. The time format, the syntax is "date 'time stamp'".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
What is the Linux command to modify the system time
The Linux date command can be used to display or set the system date and time. In terms of time, the user can set the format to be displayed. The format is set to a plus sign followed by several marks. The list of available marks is as follows:
Time:
%: Print %
%n: Next line
##%B: Month (January..December)
##%Y: The complete year (0000..9999)
If it does not start with a plus sign, it means that the time needs to be set, and the time format is MMDDhhmm[[CC]YY][.ss], where MM is the month, DD is the day, and hh is Hour, mm is the minute, CC is the first two digits of the year, YY is the last two digits of the year, ss is the second.
When you don't want meaningless 0s to appear (for example, 1999/03/07), you can insert the - symbol in the mark, such as date ' %-H:%-M:%-S ' will remove the meaningless 0s in hours, minutes and seconds. For example, the original 08:09:04 will become 8:9:4. In addition, only those with permission (such as root) can set the system time.
The syntax is:
date [-u] [-d datestr] [-s datestr] [--utc] [--universal] [--date=datestr] [--set=datestr] [--help] [--version] [+FORMAT] [MMDDhhmm[[CC]YY][.ss]]Among them: -d datestr: Display the time set in datestr (non-system time) --help: Display auxiliary information
-s datestr: Set the system time to the time set in datestr
-u: Display the current Greenwich Mean Time
--version: Display version number
Related recommendations: "
Linux Video Tutorial"
The above is the detailed content of What is the command to modify the system time in Linux?. For more information, please follow other related articles on the PHP Chinese website!