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

HTML table markup tutorial (16): title horizontal alignment attribute ALIGN

By default, the table title is horizontally cente...

Detailed introduction and usage examples of map tag parameters

Map tags must appear in pairs, i.e. <map> .....

Drop-down menu implemented by HTML+CSS3+JS

Achieve results html <div class="containe...

Steps to package and deploy the Vue project to the Apache server

In the development environment, the vue project i...

How to implement remote access control in Centos 7.4

1. SSH remote management SSH is a secure channel ...

jQuery implements clicking left and right buttons to switch pictures

This article example shares the specific code of ...

How to make React components full screen

introduce This article is based on React + antd t...

Font Treasure House 50 exquisite free English font resources Part 2

Designers have their own font library, which allo...

Node quickly builds the backend implementation steps

1. First install node, express, express-generator...

About MYSQL, you need to know the data types and operation tables

Data Types and Operations Data Table 1.1 MySQL ty...

Win32 MySQL 5.7.27 installation and configuration method graphic tutorial

The installation tutorial of MySQL 5.7.27 is reco...

Summary of 4 methods of div+css layout to achieve 2-end alignment of css

The div+css layout to achieve 2-end alignment is ...

Hyperlink icon specifications: improve article readability

1. What is the hyperlink icon specification ?<...

Summary of JavaScript's setTimeout() usage

Table of contents 1. Introduction 2. The differen...