当前位置:网站首页>MONTHS_ Between function use
MONTHS_ Between function use
2022-06-27 22:05:00 【Technical column of qingpingle】
MONTHS_BETWEEN (date1, date2)
Used to calculate date1 and date2 Between a few months . date1-date2
-- Every other month : Time format Result with decimal 16.516
SELECT MONTHS_BETWEEN('2022-05-28','2021-01-12')
-- Every other month : Month format Result integer :16
-- Method 1 : Splicing
SELECT MONTHS_BETWEEN(CONCAT(SUBSTR('2022-05-28',1,7),'-01'),
CONCAT(SUBSTR('2021-01-01',1,7),'-01'))
-- Method 2 : Intercept
SELECT CONCAT(SPLIT(MONTHS_BETWEEN('2022-05-28','2021-01-12') ,"\\.")[0])
-- Every other month : rounding 17
SELECT ROUND(MONTHS_BETWEEN('2022-05-28','2021-01-12') ,0)
-- Every other month , Round forward 16
SELECT FLOOR(MONTHS_BETWEEN('2022-05-28','2021-01-12') )
-- Every other month , Round back 17
SELECT CEIL(MONTHS_BETWEEN('2022-05-28','2021-01-12') )
-- With Chinese character format :1 Years and 1.0 Months
SELECT CONCAT(SPLIT(MONTHS_BETWEEN('2019-03-31','2018-02-28')/12,"\\.")[0]," Years and ",ROUND(MONTHS_BETWEEN('2019-03-31','2018-02-28')%12,1)," Months ");
边栏推荐
- Quick excel export according to customized excel Title Template
- 大厂常用软件测试面试题三(附答案)
- [LeetCode]186. 翻转字符串里的单词 II
- Yarn中RMApp、RMAppAttempt、RMContainer和RMNode状态机及其状态转移
- 管理系统-ITclub(上)
- Acwing week 57 longest continuous subsequence - (binary or tree array)
- Little known MySQL import data
- Interview question 3 of software test commonly used by large factories (with answers)
- Stm32cubeide1.9.0\stm32cubemx 6.5 f429igt6 plus lan8720a, configure eth+lwip
- Go from introduction to actual combat - task cancellation (note)
猜你喜欢

Interval DP of Changyou dynamic programming

Gao fushuai in the unit testing industry, pytest framework, hands-on teaching, will do this in the future test reports~

【Redis】零基础十分钟学会Redis

C语言程序设计详细版 (学习笔记1) 看完不懂,我也没办法。

百万年薪独家专访,开发人员不修复bug怎么办?

I think I should start writing my own blog.

Bit. Store: long bear market, stable stacking products may become the main theme

Management system itclub (Part 2)

At 19:00 on Tuesday evening, the 8th live broadcast of battle code Pioneer - how to participate in openharmony's open source contribution in multiple directions

Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function
随机推荐
C语言程序设计详细版 (学习笔记1) 看完不懂,我也没办法。
Test birds with an annual salary of 50w+ are using this: JMeter script development -- extension function
C language programming detailed version (learning note 1) I can't understand it after reading, and I can't help it.
QT base64 encryption and decryption
管理系统-ITclub(下)
Go from introduction to actual combat - execute only once (note)
Management system itclub (Part 2)
軟件測試自動化測試之——接口測試從入門到精通,每天學習一點點
I think I should start writing my own blog.
qt 大文件生成md5校验码
Process control task
如何做好功能测试?你确定不想知道吗?
win11桌面出现“了解此图片”如何删除
\w和[A-Za-z0-9_],\d和[0-9]等价吗?
Go from introduction to actual combat - only any task is required to complete (notes)
crontab定时任务常用命令
Professor of Tsinghua University: software testing has gone into a misunderstanding - "code is necessary"
Go 访问GBase 8a 数据库的一个方法
Yarn中RMApp、RMAppAttempt、RMContainer和RMNode状态机及其状态转移
Burp suite遇到的常见问题