Usage of MySQL time conversion function
DayOfWeek (date)Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values correspond to ODBC standards.Mysql> Select DayOfWeek (2007-10-31);-> 4Weekday (date)Returns the
/*Date_add (Date,interval expr type) and date_sub (Date,interval expr type) perform date operations. Date is a datetime or date value used to specify the start time. Expr is an expression that specifies the time interval value to be added or
Responsible for the project, using the MySQL database, on the page to show the number of registered people today, get the current month and year days, I use Curdate (),Bad SQL statementEg:select COUNT (*) from USER WHERE registerdate >= curdate ()
Responsible for the project, using the MySQL database, on the page to show the number of registered people today, get the current month and year days, I use Curdate (),Bad SQL statementEg:select COUNT (*) from USER WHERE registerdate >= curdate ()
DAYOFWEEK (date)The return date is the day of the week (1= Sunday, 2 = Monday,...... 7= Saturday, ODBC Standard)Mysql> Select DAYOFWEEK (' 1998-02-03 ');3WEEKDAY (date)The return date is the day of the week (0= Monday, 1 = Tuesday,...... 6=
DAYOFWEEK (date)The return date is the day of the week (1= Sunday, 2 = Monday,...... 7= Saturday, ODBC Standard)Mysql> Select DAYOFWEEK (' 1998-02-03 ');3WEEKDAY (date)The return date is the day of the week (0= Monday, 1 = Tuesday,...... 6=
The Date_add () function adds the specified time interval to the date.
GrammarDate_add (Date,interval expr type) The date argument is a valid datetime expression. The expr parameter is the time interval that you want to add.
The type parameter can
MySQL date_add (date,interval expr type) and date_sub (Date,interval expr type)
These functions perform date operations. Date is a DATETIME or date value that specifies the starting time. Expr is an expression that specifies the value of a time
Mysql> SELECT something from Tbl_name
WHERE To_days (now ())-To_days (Date_col)
DayOfWeek (date)
Returns the week index of date (1 = Sunday, 2 = Monday, ...). 7 = Saturday). Index values are compliant with ODBC standards.
mysql> SELECT DayOfWeek ('
MySQL Date time function encyclopediaDAYOFWEEK (date)The return date is the day of the week (1= Sunday, 2 = Monday,...... 7= Saturday, ODBC Standard)Mysql> Select DAYOFWEEK (' 1998-02-03 ');3WEEKDAY (date)The return date is the day of the week (0=
Citation@author: http://www.cnblogs.com/geaozhang/Possible requirements:What is the current time, the next month's today is the day of the week, statistics up to the current date 3 days before the sum of income ...These requirements need to be
Date and Time functionsPossible requirements:What is the current time, the next month's today is the day of the week, statistics up to the current date 3 days before the sum of income ...These requirements need to be implemented using date and time
View the last MySQL modification time for a tableSELECT table_name,update_time from Information_schema.tables where table_schema= ' database_name ';By viewing the last updated time of the table in the database.MySQL Date time function encyclopedia
Mysql database Date and Time Functions, mysql function Daquan, summary record, for later use.
DAYOFWEEK (date)The return date is the day of the week (1 = Sunday, 2 = Monday ,...... 7 = Saturday, ODBC Standard)Mysql> select DAYOFWEEK ('2017-02-03 ');-
Record an SQL statement first.Select uid, rank, money, e, from_unixtime (time/1000) from stats_2012_01_19 where comm = 8888 and e> 40 and from_unixtime (time/1000) between '2017-01-19 00:00:00 'and '2017-01-19 01:00:00'Then start to convert
ASCII (str) returns the ASCII value of the first character of the string str (0 if str is an empty string) mysqlgt; selectASCII (
ASCII (str) returns the ASCII value of the first character of the string str (0 if str is an empty string) mysqlgt;
How to calculate the period-over-period ratio of an SQL statement! The number of resumes in this month minus the number of resumes in the previous month () [number of resumes in this month]-[number of resumes in the previous month] = [number of
ASCII (str)Returns the ASCII value of the first character of the string 'str' (0 is returned when 'str' is an empty string)Mysql> selectASCII ('2 ');-> 50Mysql> select ASCII (2 );->50Mysql> select ASCII ('dete ');-> 100ORD (str)If the string 'str'
MySql time processing and mysql Processing
Many times, we want to process the time when querying the Mysql database, such as formatting or other operations. This avoids further processing, mysql also has many time-related processing functions. Today,
Not easy Ah, the weather is very hot, finally to the weekend but nowhere to go, last night on the special application to the wife for a short weekend time to summarize the recent work, it is not easy, if the application is not approved, I have to
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.