# What day of the week is a date (1= Sunday ,2= Monday ,…………,7= Saturday ). SELECT DAYOFWEEK('2019-09-23')
# What day of the week is a date (0= Monday ,1= Tuesday ,…………,6= Sunday ). SELECT WEEKDAY('2019-09-29')
# Query the date of the month (1-31) . SELECT DAYOFMONTH('2019-09-29') # Query the date of the year (1-366) .
SELECT DAYOFYEAR('2019-09-29') # Query month of a date (1-12). SELECT MONTH('2019-01-29')
# Query the week of a day , Return English words . SELECT DAYNAME('2019-09-29') # Query month of a date , Return English words . SELECT
MONTHNAME('2019-09-29') # Query quarter of a date (1-4) SELECT QUARTER('2019-11-28')
# Query a day is the day of the year , The second parameter is optional , The default is the server's default week mode , # Query the default week mode of the server :SHOW VARIABLES LIKE
'default_week_format'; # What day does a week start ,(0-7 New week from Sunday - It starts on Saturday ). SELECT
WEEK('2019-01-06') SELECT WEEK('2019-01-01','1') # Year of query date ( stay 1000-9999). SELECT
YEAR('2019-01-06') # Get hours (0-23). SELECT HOUR('2019-01-06 13:05:03') SELECT
HOUR('13:05:03') # Return minutes (0-59). SELECT MINUTE('2019-01-06 13:59:03') SELECT
MINUTE('13:59:03') # Returns the number of seconds (0-59). SELECT SECOND('2019-01-06 13:59:03') SELECT
SECOND('13:59:03') # Return date after adding month to a date ( Date format YYMM or YYYYMM, The latter is recommended .). SELECT
PERIOD_ADD('201909','-14') SELECT PERIOD_ADD('201909','14') # Query the number of months between two dates .
SELECT PERIOD_DIFF('201909','201909') SELECT PERIOD_DIFF('201809','201909')
SELECT PERIOD_DIFF('201909','201809')
# Reduce or increase the number of seconds to a date ( Annual use year, month month, Day use day, Hours hour, Minutes minute). SELECT
DATE_ADD('1999-12-31 23:59:59',INTERVAL 1 SECOND) SELECT DATE_SUB('1999-12-31
23:59:59',INTERVAL 1 SECOND) SELECT ADDDATE('1999-12-31 23:59:59',INTERVAL 1
# The composite units are as follows , That is, multiple unit time operations are performed on the time . SELECT SUBDATE('1999-12-31 23:59:59',INTERVAL '1 1'
SELECT SUBDATE('1999-12-31 23:59:59',INTERVAL '1 1' DAY_HOUR) SELECT
SUBDATE('1999-12-31 23:59:59',INTERVAL '1 1' YEAR_MONTH) # format date ( Here are several commonly used modes ).
SELECT DATE_FORMAT('2009-08-13 10:08:52','%Y year %m month %d day %H Time %i branch %s second ') SELECT
DATE_FORMAT('20090813100852','%Y-%m-%d %H:%i:%s') # format date , This function can only handle hours , Minutes and seconds . SELECT
TIME_FORMAT('2009-08-13 10:08:52','%H Time %i branch %s second ') SELECT
TIME_FORMAT('20090813100852','%H:%i:%s') # Returns the current date , The format is :%Y-%m-%d. SELECT CURDATE()
SELECT CURRENT_DATE() # Return to current time , The format is :%H:%i:%s. SELECT CURTIME() SELECT
CURRENT_TIME() # Return time , The format is :%Y-%m-%d %H:%i:%s. SELECT NOW() SELECT SYSDATE()
SELECT CURRENT_TIMESTAMP() # Returns the timestamp corresponding to the date . SELECT UNIX_TIMESTAMP('2009-08-13
10:08:52') SELECT UNIX_TIMESTAMP('20090813100852') # Generate millisecond level timestamp SELECT
REPLACE(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(3)),'.','') order_number ; # Generate second level timestamp
SELECT UNIX_TIMESTAMP() # Returns the date corresponding to the timestamp . SELECT FROM_UNIXTIME(1250129332) SELECT
FROM_UNIXTIME(1250129332,'%Y-%m-%d %H:%i:%s') # How many seconds has passed since the day of the year . SELECT
TIME_TO_SEC('2009-01-01 00:01:50') # Returns how many seconds a time passed on the day . SELECT
TIME_TO_SEC('00:00:21'); # The difference between the two dates , Subtract the previous date from the later date ( Result return -10) SELECT
DATEDIFF('2008-08-8', '2008-08-18')

©2019-2020 Toolsou All rights reserved,
Image format conversion Count the number of letters (java Language implementation ) Using orthogonal table method to design test cases One is called “ Asking for the train ” A small village Finally got the train VaR - Value at risk - Monte Carlo method - Python How to build data security system ?python: Convert a file to a binary file (binary)vue use vue-clipboard2 Realize the function of copy link 13. solve git Merge conflict uniapp Summary of page value transfer