The date command can get the current time. man shows that many parameters of date can be used, which is easy to format.
For example:
Copy codeThe code is as follows:Date + "% F"Output Format: 2011-12-31
Date + "% F % H: % M: % S"Output Format: 201
Transferred from: http://blog.chinaunix.net/uid-25906157-id-3138157.htmlBefore using the board, it was discovered that the system's time was restored to its initial state for 1970 years after each boot.First, the concept of the clock, the clock
Date commandShell script print time in Linux.Date syntaxDate (option) (parameter) (a space must be added after date).There are several options-D "string": Displays the time specified by the string;-S "string": Sets the time based on the string;-U:
How to use: Date [-u] [-D DATESTR] [-S datestr] [--UTC] [--universal] [--DATE=DATESTR] [--SET=DATESTR] [--help] [--version] [+f ORMAT] [MMDDHHMM[[CC]YY][.SS]]Description: Date can be used to display or set the system's Day and time, in terms of
Feature Description: Displays or sets the system time and date.Syntax: Date[-D [-u][+%h%i%k%l%m%p%r%s%s%t%x%z%a%a%b%b%c%d%d%j%m%u%w%x%y%y%n%t] orDate [-S ][-u] [Mmddhhmmccyyss] or date [--help][--version]Supplemental NOTE: The first syntax can be
The use of the date command1. Used to display a special time format that can be used to name the log file2. Used to set the time, but this is relatively small, because the general server is set to have automatic synchronization network
Today study date, make a summary, easy to consult later.Command format display time: Date [option] ... [+format]Modified: Date [month day hour minutes]1. Display the current time date2. Date parameter%F: Indicates the month and day%T: minutes and
Show Current time:Command: [Email protected]:~$ date Thu 03:01:17 PDT [email protected]:~$ date ' +%x ' 08/31/201 7 Display date and set time:Command: Date--date 08:42:00The date-d parameter uses:date-d "Nov 22" This year's November 22 is
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=
Direct run will show time[Email protected] shell]# Datesat APR 12:56:47 CST 2016View Calendar[[email protected] shell]# cal April 2016Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 910 11 12 13 14 15 1617 18 19 20 21 22 2324 25 26 27 28 29 30View a full year[[
In the Linux environment, whether it is programming or other maintenance, time is essential, but also often use the operation of time, skilled use of the date command to express the time they want to express, can certainly give their work to bring
1. System HelpC:\>date/?
Displays or sets the date.
Date [/T | date]
Just type Date without arguments, you can display the current date setting, and prompt
You enter a new date. Press ENTER to keep the original date.
If the command extension is
In Linux shell programming, date addition and subtraction operations are often used
I used to calculate myself through the expr function, which is troublesome.
In fact, the date command itself provides the addition and subtraction of dates.
Very
Shell Script IntroductionShell is a scripting language blog.lishiming.net (Amin blog, you can go inside to find the shell problem)You can use logical judgments, loops, and other syntaxFunctions can be customized to reduce duplication of codeThe
The simplest output:# datewed June 6 : £20181. Gets the current time, output in the specified format: # date +%y-%m-%d standard output date (where: + must be,-optional, can also be output according to the specified style, for example:/,* 2018 -06 -
Date: The command to display the timeCommon Command ParametersUsage: 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=
Want to add some task plan in root crontab, want to run command with WWW user, and redirect output to a log file named at that time, roughly as follows/usr/bin/sudo-u www/usr/local/php/bin/php/www/open/www.php &>/var/log/xxx_cron_log/www_$ (date + "%
Transfer from http://blog.chinaunix.net/uid-8223172-id-2511672.htmlThe use of date in Linux is more complex, but it also uses more, especially in the shell. Now summarize some of the usage that you often use.1. Time Settings# date-s 20080305-------->
The data command displays and changes the system timeDate Syntax and parameters:Date [OPTION] ... [+format]Date [-u|--utc|--universal] [MMDDHHMM[[CC]YY][.SS]]
Parameters
Words
Description
-S
Set
1. Get the various usages of today's date:[Email protected] ~]# date +%y_%m_%d2016_05_22[[Email protected] ~]# Date ' +%y_%m_%d '2016_05_22[[Email protected] ~]# date "+%y_%m_%d"2016_05_22[[Email protected] ~]# date + '%y_%m_%d '2016_05_22[[Email
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.