Here is an example of using the date function. The following query Selects all records. The value of date_col is within the last 30 days:
Date_format (from_unixtime ('2017-10-04 22:23:00 '),' % Y/% m/% D ')
Mysql> select something from tableWhere
Yesterday, the billing system was faulty. After the phone hangs up, TG lost the message bye sent to the software, causing homeserver to wait until timeout. As a result, a large number of long phone calls were generated. After positioning for one
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 ');-> 3Weekday (date)Returns the date of a week (0 = Monday, 1 = Tuesday ,...... 6 = Sunday
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 ). The index value complies with ODBC standards.Mysql> select dayofweek ('2017-
Usage of MySQL time Conversion Function
Dayofweek (date)Returns the index of the week of the date (1 = Sunday, 2 = Monday ,...... 7 = Saturday ). These index values correspond to the ODBC standard.Mysql> select dayofweek (2007-10-31 );-> 4
MySQL increases or decreases the specified time interval for all the current data tables (recommended ).
The DATE_ADD () function adds a specified interval to a date.
All data in the current table will be added one day later:
UPDATE ACT_BlockNum SET
Returns the week index of date (0 = Monday, 1 = Tuesday ,...... 6 = Sunday ). Mysql> select weekday ('2017-10-04 22:23:00 ');-> 5 mysql> select weekday ('2017-11-05');-> 2 dayofmonth (date) returns the date of a month in the range of 1 to 31. Mysql>
For the description of the valid format of the value range of each type and the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using the date function. The following query Selects all records. The value of
For the description of the valid format of the value range of each type and the specified date and time value, see 7.3.6 Date and Time type. Here is an example of using the date function. The following query Selects all records. The value of
For the description of the valid format of the value range of each type and the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using the date function. The following query Selects all records. The value of
MySQL Date time function encyclopedia1. 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 ');32. WEEKDAY (date)The return date is the day of the week
The code is as follows
Copy Code
Mysql> SELECT something from tableWHERE To_days (now ())-To_days (Date_col) DayOfWeek (date)
Returns the week index of date (1= Sunday, 2 = Monday, ...). 7= Saturday). These index values
1 Get current date + time (date + times) 1.1 function: Now ()
Related functions: Current_timestamp (), localtime (), Localtimestamp ()
2. Get Current date
Function: Curdate ()
Related functions: Current_date (), current_date
3. Get current time
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
For a description of the range of values owned by each type and the valid format for the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using a date function. The following query selects all records and its
1. Date Time function
Time Conversion second function: Time_to_sec
Mysql> Select Time_to_sec (' 01:01:01 ');+-------------------------+| Time_to_sec (' 01:01:01 ') |+-------------------------+| 3661 |+-------------------------+1 row in Set (0.00
For a description of the range of values owned by each type and the valid format for the specified date and time value, see 7.3.6 Date and Time type.
Here is an example of using a date function. The following query selects all records and its
MySQL page access statistics and ranking situation
Count the number of pages visited to rank by resolution
SELECT CONCAT (' height ', ' * ', ' width ') as ' resolution ', COUNT (CONCAT (' height ', ' * ', ' width ')) as ' total ' from
'
This is an example of a stored procedure written today.
It's been written for 3 days, but it hasn't progressed since I've written only HelloWorld-level stored procedures ...
This is also based on a colleague wrote the demo to write about half an
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.