1. Display timeThe date command displays dates in the specified format, and only date displays the current time in the default format. As follows:If you need to display the date in the specified format, you can use a string that begins with "+" to
In Linux shell programming, adding and subtraction operations that are often used for dates are previously calculated by using the expr function, which is cumbersome. In fact, the date command itself provides a convenient addition and subtraction of
In the Linux environment, whether it is programming or other maintenance, time is essential, but also often use the time of the operation, skilled use of the date command to express the time you want to express, certainly can give their work to
Help information for the date command[root@localhost source]# date--helpusage: 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=
Original URL: http://www.cnblogs.com/peida/archive/2012/12/13/2815687.htmlIn the Linux environment, whether it is programming or other maintenance, time is essential, but also often use the time of the operation, skilled use of the date command to
How to use the date command under Linux
in Linux, the date command is a very common command that we often need to use to view system time, set system time, and so on.
1. Set the system time directly using the date command
such as: Set the
First, what is the shell?
The shell is a scripting language aming_linux blog.lishiming.net
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The shell is a collection of system commands
Shell scripts
1. Display timeThe date command displays dates in the specified format, and only date displays the current time in the default format. As follows:If you need to display the date in the specified format, you can use a string that begins with "+" to
- 20.1 shell script describes the- 20.2 shell script structure and executes- 20.3 date command usage- 20.4 shell the variables in the script # 20.1 shell Script Introduction- shell is a scripting language attention
Shell Script Introduction
Shell is a scripting language
You can use logical judgments, loops, and other syntax
Functions can be custom-defined
The shell is a collection of system commands
Shell scripts enable automated
Shell Script Introduction
Shell is a scripting language
The shell has its own syntax, and can use logical judgments, loops, and so on.
Functions can be customized to reduce duplicate code
The shell is a collection
Help information for the date command[Email protected] source]# date--helpUsage: 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=
The most primitive method is to write a complicated function, know the number of days each month, and handle the leap year situation-this is a bit tedious.
Take a look at the date command and you will find that using it can easily write a very
Date command usage
1. System HelpC:> date /?Display or set a date.
Date [/T | date]
Enter only date without adding a parameter. The current date setting is displayed and a prompt is displayed.Enter a new date. Press enter to maintain the original
How to Use the date command in Linux
In this article, we will use some cases to demonstrate how to usedateCommand.dateCommand to output/set the system date and time.dateThe command is simple. See the example and syntax below.
By defaultdateCommand,
Date command summary, date Summary
The date command is a common command for viewing date and time. The date MMDDhhmmYY. ss (change order) is used to change the time.
Linux time is divided into system time and hardware time,
[Root @ www doc] # clock -
1. Command format:Date [parameter] ... [+ format]2. Command function:Date can be used to display or set the day and time of the system.3. Command parameters:Necessary parameters:%H hours (expressed in 00-23).%I Hours (expressed in 01-12).%K hours
Original: JavaScript's date format, which mimics the format of the date command in the shellThe current date is displayed in the shell[[email protected]]$ date '+%Y-%m-%d %H:%M:%S'2015-01-19 16:24:58It is inconvenient to format the date object in
Many times we look at the data in the database, or the data in other people's systems need to be time-stamped to query, or the result of the query is a timestamp. There are times when you need to enter a timestamp for the query condition. My
Date instruction Related Usage exampleDate usage: date [OPTION] ... [+format]Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]Enter Date directlyDate specified format display time: Date +%y_%m_%d, date +%y:%m:%dDate can be used to display or set
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.