当前位置:网站首页>MySQL winter vacation self-study 2022 12 (5)
MySQL winter vacation self-study 2022 12 (5)
2022-07-01 04:21:00 【Crane paper thousand】
The picture is from (46 Bar message ) mysql The output is currently used in the week week and weekofyear The difference between _ Eight bowls of water blog -CSDN Blog
-- Date function
-- 1, Get the timestamp ( Millisecond value )
select unix_timestamp();
-- 2, Convert a date string to a millisecond value
select unix_timestamp('2021-12-21 08:08:08');
-- 3, Converts the timestamp millisecond value to a date in the specified format
select from_unixtime(1640045288,'%Y-%m-%d %H:%i:%s');# Capitalization y And lowercase y Different , Check the table if necessary
-- 4, Get the current date
select curdate();
select current_date;
-- 5, Get the current hour, minute, second
select current_time();
select curtime();
-- 6, Get date and Minutes and seconds
select current_timestamp();
-- 7, Get the date from the date string
select date('2022-12-12 12:34:56');
-- 8, Get interpolation between dates
select datediff('2021-12-23','2008-08-08');#4885, The front minus the back
select datediff('2008-08-08','2021-12-23');#4885
select datediff(current_time(),'2008-08-08');
-- 9 Get the difference in time ( Minutes and seconds )
select timediff('12:12:34','10:18:56');
-- 10, Date formatting
select date_format('2021-1-1 1:1:1','%Y-%m-%d %H:%i:%s');
-- 11, Convert string to date
select str_to_date('2021-1-1 1:1:1','%Y-%m-%d %H:%i:%s');
-- 12, Subtract the date
select date_sub('2021-10-01',interval 2 day);
select date_sub('2021-10-01',interval 2 month);
-- 13, Add the date
select date_add('2021-10-01',interval 2 day);
-- 14, Get the hour from the date (year,month, Fine )
select extract(hour from '2021-1-2 3:4:4');
-- 15, Get the last day of the month in which the given date is located
select last_day('2021-8-13');#2021-08-31
-- 16, Gets the date of the year and the specified number of days eg,2021 The fifty third day of the year
select makedate('2021',53);
-- 17, Get the year, minute and second according to the date
select year('2021-1-2 3:4:4');
select month('2021-1-2 3:4:4');
select minute('2021-1-2 3:4:4');
select quarter('2021-1-2 3:4:4');# Get Quarterly
-- 18, Get information based on date
select monthname('2021-1-2 3:4:4');
select dayname('2021-1-2 3:4:4');# What day , english
select dayofmonth('2021-1-2 3:4:4');# What day of the month
select dayofweek('2021-1-2 3:4:4');# What day of the week 1 It's Sunday
select dayofyear('2021-1-2 3:4:4');# What day of the year
select week('2021-1-2 3:4:4');# Week , The scope is 0-53
select weekday('2021-1-2 3:4:4');#0 It means Monday
select weekofyear('2021-1-2 3:4:4');
select yearweek('2021-3-01');
-- Get the current date and time
select now();
边栏推荐
- Knowledge supplement: redis' basic data types and corresponding commands
- Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security
- TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 桥接器与交换机 / 3.4.2 多属性注册协议(Multiple Registration Protocol (MRP))
- 【人话版】WEB3黑暗森林中的隐私博弈
- 采购数智化爆发在即,支出宝'3+2'体系助力企业打造核心竞争优势
- LeetCode 1827. Increment array with minimal operation
- “目标检测“+“视觉理解“实现对输入图像的理解
- 创新界,聚势行 | 2022人大金仓“百城巡展”火热开启
- 小程序中自定义组件
- How to ensure the idempotency of the high concurrency interface?
猜你喜欢
Custom components in applets
Tip of edge browser: enter+ctrl can automatically convert the address bar into a web address
Embedded System Development Notes 79: why should I get the IP address of the local network card
Recommend the best product development process in the Internet industry!
Use of JMeter counters
嵌入式系统开发笔记79:为什么要获取本机网卡IP地址
Jenkins自动清理构建历史
基于Unet的环路滤波
Unity之三维空间多点箭头导航
Hololens2 development environment building and deploying apps
随机推荐
mysql 函数 变量 存储过程
基于Unet的环路滤波
Procurement intelligence is about to break out, and Alipay'3+2'system helps enterprises build core competitive advantages
MallBook:后疫情时代下,酒店企业如何破局?
"Target detection" + "visual understanding" realizes the understanding of the input image
LetCode 1829. Maximum XOR value per query
431. encode n-ary tree as binary tree DFS
One job hopping up 8K, three times in five years
Maixll-Dock 快速上手
LeetCode 1399. Count the maximum number of groups
嵌入式系统开发笔记81:使用Dialog组件设计提示对话框
MySQL advanced -- you will have a new understanding of MySQL
Unity's 3D multi-point arrow navigation
283. move zero
Internet winter, how to spend three months to make a comeback
Daily question - line 10
(12) Somersault cloud case (navigation bar highlights follow)
Haskell lightweight threads overhead and use on multicores
How to choose the right server for website data collection?
1. Mobile terminal touch screen event