Linux date command to view and set the time details (graphic)

  

date command The function of the date command is to display and set the system date and time. The general format of the command is: date [options] display time format (starting with +, followed by format) date setting the time format The meaning of each option in the command is:


The code is as follows : -d datestr, --date datestr Display the date described by datestr -s datestr, --set datestr Set the date described by datestr -u, --universal Display or set universal time

Time domain

The code is as follows: % H hours (00..23) % I hours (01..12) % k hours (0..23) % l hours (1..12) % M points (00..59 % p shows AM or PM % r time (hh:mm:ss AM or PM), 12 hours % s from January 1, 1970 00:00:00 to the current number of seconds % S seconds (00. .59) % T time (24-hour clock) (hh:mm:ss) % X Display time format (%H:%M:%S) % Z Time zone date field % a Short for day of the week ( Sun..Sat % A Full name of the day of the week (Sunday..Saturday) Abbreviation for the month of January (Jan..Dec) % Full name of the month of January (January..December) % c Date and time ( Mon Nov 8 14:12:46 CST 1999) % d The first few days of the month (0 1..31) % D Date (mm/dd/yy) % h and %b options are the same % j Day of the year (001..366) % m Month (01..12) % w One week Days (0 for Sunday) % W The first few weeks of the year (00..53, Monday is the first day) % x Display the format of the date (mm/dd/yy) % y The last two of the year Number (1999 is 99) % Y year (for example: 1970, 1996, etc.)

Note: Only superusers have permission to set the time using the date command. Generally, users can only use the date command to display the time. Displaying the date and time In the character interface, in addition to displaying the year and month, the user can also use the “date” command to display and set the system date and time. It is important to note that only superusers can use the “date” command to set the time. Normal users can only use the “date” command to display the time. Display format specified time, the following command:



% x wherein the date display format (mm /dd /yy),% X time display format (% H: %M:%S). Other parameters can be found in the setting of the date time field above.

Example:

Code Example: Set the time to 9:16 AM The command is as follows: # date -s 09:16:00

The setting time is August

Copyright © Windows knowledge All Rights Reserved