当前位置:网站首页>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();边栏推荐
- Libevent Library Learning
- Embedded System Development Notes 80: using QT designer to design the main interface
- JD intelligent customer service Yanxi intention system construction and intention recognition technology introduction
- OSPF notes [multiple access, two multicast addresses with OSPF]
- PageObject模式解析及案例
- "Target detection" + "visual understanding" realizes the understanding of the input image
- Edge浏览器的小技巧:Enter+Ctrl可以自动将地址栏转换为网址
- JMeter学习笔记2-图形界面简单介绍
- Qt development experience tips 226-230
- Learn Chapter 20 of vue3 (keep alive cache component)
猜你喜欢
![[ta - Frost Wolf May - 100 people plan] 1.2.1 base vectorielle](/img/94/99090ea91082a385968e071ef3766c.png)
[ta - Frost Wolf May - 100 people plan] 1.2.1 base vectorielle

Go learning --- unit test subtest

Knowledge supplement: redis' basic data types and corresponding commands

LeetCode 1828. Count the number of points in a circle

线程常用方法与守护线程

Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services

Task04 mathematical statistics

【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码

【发送邮件报错】535 Error:authentication failed

Obtain detailed ideas for ABCDEF questions of 2022 American Games
随机推荐
Libevent Library Learning
283. move zero
Network metering - application layer
How to ensure the idempotency of the high concurrency interface?
NFT: utilisez EIP - 2981 pour commencer un voyage de redevances NFT
嵌入式系統開發筆記80:應用Qt Designer進行主界面設計
Leetcode learning - day 36
Analyse et cas du modèle pageobject
2. Use of classlist (element class name)
Use of JMeter counters
OSPF notes [dr and bdr]
嵌入式系统开发笔记79:为什么要获取本机网卡IP地址
What are permissions? What are roles? What are users?
高并发下接口幂等性如何保证?
[today in history] June 30: von Neumann published the first draft; The semiconductor war in the late 1990s; CBS acquires CNET
What does ft mean in the data book table
Knowledge supplement: basic usage of redis based on docker
【历史上的今天】6 月 30 日:冯·诺依曼发表第一份草案;九十年代末的半导体大战;CBS 收购 CNET
创新界,聚势行 | 2022人大金仓“百城巡展”火热开启
NFT:使用 EIP-2981 開啟 NFT 版稅之旅