Use the date command

Source: Internet
Author: User
Tags current greenwich mean time

Date command name: date permission: usage by all users: date [-u] [-d datestr] [-s datestr] [-- utc] [-- universal] [-- date = datestr] [-- set = datestr] [-- help] [-- version] [+ FORMAT] [MMDDhhmm [[CC] YY] [. ss] Note: date can be used to display or set the date and time of the system. In terms of display, you can set the format to be displayed. The format is set to a plus sign followed by several tags, the available tag list is as follows: Time: %: printed % n: Next row % t: Hop % H: hour (0 .. 23) % I: hour (01 .. 12) % k: hour (0 .. 23) % M: minute (0 .. 59) % p: displays the local time period "Morning" or "Afternoon" % r: displays the time directly (in 12-hour format: hh: mm: ss [AP] M) % S: the number of seconds from January 1, 1970 00:00:00 UTC till now % S: seconds (00 .. 61) % T: direct display time (in 24-hour format) % X: equivalent to % H: % M: % S % Z: Display Time Zone date aspect: %: day of the week (Mon .. sun) % A: The day of the week (Monday .. sunday) % B: Month (Jan .. dec) % B: Month (January .. december) % c: Display date and time % d: Day (01 .. 31) % D: Display date (mm/dd/yy) % h: Same as % B % j: day of the year (001 .. 366) % m: Month (01 .. 12) % U: Week (00 .. 53) (Sunday is the first day of a week) % w: The day of a week (0 .. 6) % W: Week (00 .. 53) (Monday is the first day of a week Case) % x: Date (mm/dd/yy) % y: last two digits of the Year (00.99) % Y: complete year (0000 .. 9999) if it does not start with a plus sign, it indicates the time to be set, and the time format is MMDDhhmm [[CC] YY] [. ss], where MM is the month, DD is the day, hh is the 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 number of seconds to count: -d datestr: display the time set in datestr (non-system time) -- help: display the auxiliary message-s datestr: set the system time to the time set in datestr-u: display the current Greenwich Mean Time -- version: display version number example: show the time after the line, and then display the current date: date + % T % n % D show the month and number of days: date + % B % d display date and set time (12:34:56): date -- date 12:34:56 Note: If you do not want meaningless 0 values (for example,), you can insert the-symbol in the tag, for example, date + %-H: %-M: %-S removes the meaningless 0 in the hour, minute, and second, as if the original 08:09:04 will change. In addition, you can set the system time only when you have the permission (such as root. After you change the system time as root, remember to write the system time to CMOS using clock-w, in this way, the system time will continue to hold the latest correct value upon the next reboot.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.