Summary of Linux date command knowledge points

Summary of Linux date command knowledge points

Usage: date [options]... [+format] or: date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

Displays the current time in the given format, or sets the system date.

-d, --date=string Display the time described by the specified string instead of the current time
-f, --file=date file is similar to --date, read the time description line by line from the date file
-r, --reference=file Display the last modification time of the specified file
-R, --rfc-2822 Output date and time in RFC 2822 format Example: Monday, August 7, 2006 12:34:56 -0600
--rfc-3339=TIMESPEC Output date and time in RFC 3339 format.
TIMESPEC=`date',`seconds',or`ns'
Indicates the display precision of date and time.
Date and time units are separated by a single space:
2006-08-07 12:34:56-06:00
-s, --set=string Set the specified string to separate the time
-u, --utc, --universal Output or set Coordinated Universal Time
--help Display this help message and exit
--version show version information and exit

The given format FORMAT controls the output, interpreting the sequence as follows:

%% A literal %
%a The abbreviation of the day of the week in the current locale (e.g. day for Sunday)
%A The full name of the day of the week in the current locale (e.g. Sunday)
%b The abbreviation of the month name in the current locale (e.g., 一, for January)
%B The full name of the month in the current locale (e.g. January)
%c The current locale date and time (e.g. Thursday, March 3, 2005 23:05:25)
%C Century; like %Y, usually omitting the last two digits of the current year (for example: 20)
%d The day of the month (for example: 01)
%D Day of the month; equal to %m/%d/%y
%e The day of the month, add a space, equal to %_d
%F Full date format, equivalent to %Y-%m-%d
%g Last two digits of the year in ISO-8601 format (see %G)
%G ISO-8601 format year (see %V), usually only used in conjunction with %V
%h is equal to %b
%H Hours (00-23)
%I Hour (00-12)
%j Date in year (001-366)
%k hour (0-23)
%l hours (1-12)
%m Month (01-12)
%M points (00-59)
%n Line break
%N Nanoseconds (000000000-999999999)
%p "AM" or "PM" in the current locale. Output is empty if unknown.
%P is similar to %p, but outputs lowercase letters
%r The 12-hour clock time in the current locale (e.g. 11:11:04 PM)
%R 24-hour time, hours and minutes, equivalent to %H:%M
%s The number of seconds that have passed since 1970-01-01 00:00:00 UTC
%S Seconds (00-60)
%t Output tab character
%T time, equal to %H:%M:%S
%u Week, 1 represents Monday
%U Week number of the year, with Sunday as the first day of the week (00-53)
%V The week number of the year in ISO-8601 format, with Monday as the first day of the week (01-53)
%w The day of the week (0-6), 0 represents Monday
%W Week number of the year, with Monday as the first day of the week (00-53)
%x Date description in the current locale (e.g. 12/31/99)
%X Time description in the current locale (e.g. 23:13:48)
%y The last two digits of the year (00-99)
%Y Year
%z +hhmm numeric time zone (e.g., -0400)
%:z +hh:mm numeric time zone (e.g., -04:00)
%::z +hh:mm:ss numeric time zone (e.g., -04:00:00)
%:::z Numeric time zone with necessary precision (e.g., -04, +05:30)
%Z Alphabetical time zone abbreviation (e.g., EDT)

By default, numeric fields for dates are filled with zeros.

The following optional tokens may follow the "%":

- (hyphen) does not fill this field
_ (underscore) is filled with spaces
0 (number 0) fill with 0
^ Use uppercase letters when possible
# Use reverse case when possible

An optional field width specification is also allowed after any markers, which is a decimal number.

As an optional modifier, it can be E, using the locale-specific

representation; or O, using the locale's associated numeric symbol when possible.

The above is all the relevant content compiled by the editor of 123WORDPRESS.COM. Thank you for your learning and support.

You may also be interested in:
  • Linux date time setting synchronization command sharing
  • Solution to the problem of date command conversion date prompt date: illegal time format in Linux
  • Detailed explanation of the use of the Linux software version management command update-alternatives
  • Date command under Linux, formatted output, time setting method
  • Detailed explanation of the use of date in Linux commands (script example for calculating the dates of Mother's Day and Father's Day)
  • Use of Linux date command

<<:  How to manually install MySQL 5.7 on CentOS 7.4

>>:  WeChat applet custom tabBar step record

Recommend

Detailed explanation of how to use the Vue license plate search component

A simple license plate input component (vue) for ...

How to use Vue to implement CSS transitions and animations

Table of contents 1. The difference between trans...

Detailed tutorial on MySQL installation and configuration

Table of contents Installation-free version of My...

Tutorial diagram of installing CentOS and Qt in Vmware virtual machine

Vmware Installation Installing Packages Download ...

Tutorial on using Webpack in JavaScript

Table of contents 0. What is Webpack 1. Use of We...

How to import js configuration file on Vue server

Table of contents background accomplish Supplemen...

How to install kibana tokenizer inside docker container

step: 1. Create a new docker-compose.yml file in ...

MySQL merges multiple rows of data based on the group_concat() function

A very useful function group_concat(), the manual...

HTML implements the function of detecting input completion

Use "onInput(event)" to detect whether ...

JavaScript implements the nine-grid click color change effect

This article shares the specific code of JavaScri...

Detailed explanation of Vue save automatic formatting line break

I searched for many ways to change it online but ...

Example of using CSS3 to create Pikachu animated wallpaper

text OK, next it’s time to show the renderings. O...