当前位置:网站首页>MySQL and PgSQL time related operations
MySQL and PgSQL time related operations
2022-04-23 13:41:00 【Wangcai 2】
mysql Time operation
Get the current time
select now();
2022-01-15 15:31:34.0
Before getting the current time 1 Days time
select DATE_SUB(CURRENT_TIMESTAMP,INTERVAL 1 day);
The optional values are as follows :

String rotation date
select str_to_date(DATE_SUB(now(),INTERVAL 0 day),'%Y-%m-%d %H:%i:%s');
Time format
select date_format(now(),'%Y-%m-%d %H:%i:%s');
pgsql Time operation
Get the current time
select now();
2022-01-15 15:44:19.619571
Before getting the current time 1 Days time
select now() - interval '1 day'
The optional values are as follows :
Time format
select to_timestamp(now(),'yyyy-mm-dd hh24:mi:ss') - interval '1 day'
String to time
to_timestamp('2022-01-22 00:00:00','yyyy-MM-dd hh24:mi:ss')
Gets the minutes and seconds of the year, month and day
select extract(year from now()) || extract(month from now()),extract(day from now()),extract(hour from now()),extract(minute from now()),extract(second from now())
String interception
select substr(to_timestamp(now(),'yyyy-mm-dd hh24:mi:ss'),1,19)
版权声明
本文为[Wangcai 2]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230604300404.html
边栏推荐
- Launcher hides app icons that do not need to be displayed
- 为什么从事云原生开发需要学习容器技术
- Detailed explanation and usage of with function in SQL
- RTOS mainstream assessment
- You and the 42W bonus pool are one short of the "Changsha bank Cup" Tencent yunqi innovation competition!
- On the bug of JS regular test method
- TIA博途中基于高速计数器触发中断OB40实现定点加工动作的具体方法示例
- 切线空间(tangent space)
- 普通大学生如何拿到大厂offer?敖丙教你一招致胜!
- Lenovo Savior y9000x 2020
猜你喜欢

Ai21 labs | standing on the shoulders of giant frozen language models

Detailed explanation of constraints of Oracle table
![[indicators] precision, recall](/img/40/8fbd9b83bd2fe8ac13ffeb1834b002.png)
[indicators] precision, recall

缘结西安 | CSDN与西安思源学院签约,全面开启IT人才培养新篇章

Short name of common UI control
![[Video] Bayesian inference in linear regression and R language prediction of workers' wage data | data sharing](/img/12/a330b5e77921bbfa8e96fcbc660daa.png)
[Video] Bayesian inference in linear regression and R language prediction of workers' wage data | data sharing

Super 40W bonus pool waiting for you to fight! The second "Changsha bank Cup" Tencent yunqi innovation competition is hot!

Opening: identification of double pointer instrument panel
![[point cloud series] pointfilter: point cloud filtering via encoder decoder modeling](/img/da/02d1e18400414e045ce469425db644.png)
[point cloud series] pointfilter: point cloud filtering via encoder decoder modeling

AI21 Labs | Standing on the Shoulders of Giant Frozen Language Models(站在巨大的冷冻语言模型的肩膀上)
随机推荐
Database transactions
GDB的使用
交叉碳市场和 Web3 以实现再生变革
Longitude and latitude position of provincial capitals in China
Ai21 labs | standing on the shoulders of giant frozen language models
The difference between string and character array in C language
榜样专访 | 孙光浩:高校俱乐部伴我成长并创业
AI21 Labs | Standing on the Shoulders of Giant Frozen Language Models(站在巨大的冷冻语言模型的肩膀上)
[indicators] precision, recall
Opening: identification of double pointer instrument panel
校园外卖系统 - 「农职邦」微信原生云开发小程序
Innobackupex incremental backup
Launcher hides app icons that do not need to be displayed
CSDN College Club "famous teacher college trip" -- Hunan Normal University Station
Android clear app cache
Detailed explanation of ADB shell top command
Software test system integration project management engineer full truth simulation question (including answer and analysis)
[dynamic programming] 221 Largest Square
Solve the problem that Oracle needs to set IP every time in the virtual machine
顶级元宇宙游戏Plato Farm,近期动作不断利好频频