当前位置:网站首页>Spark SQL common time functions
Spark SQL common time functions
2022-06-27 06:23:00 【The south wind knows what I mean】
List function
current_date() The current date
select current_date();
--2022-02-22
- now() or current_timestamp() current time
select now();
select current_timestamp();
--2022-02-22 22:22:22
- datediff(endDate, startDate) The number of days between the dates
select datediff('2022-02-22','2022-02-20');
--2
- months_between(endDate, startDate) Month difference between dates
select months_between('2022-06-16','2022-02-12');
--4.12903226
- date_add(startDate, numDays) Date plus N God
select date_add('2022-02-22',3)
--2022-02-25
select date_add('2022-02-22',-3)
--2022-02-19
- date_sub(startDate, numDays) Date minus N God
select date_sub('2022-02-22',3)
--2022-02-19
select date_sub('2022-02-22',-3)
--2022-02-25
- add_months(startDate, numMonths) Date plus N month
select add_months('2022-02-22',3);
--2022-05-22
select add_months('2022-02-22',-3);
--2021-11-22
- last_day(date) The last day of the month in which the date is
select last_day('2022-02-22');
--2022-02-28
- next_day(startDate, dayOfWeek) The first day of the week after the specified date ( Week parameter is English abbreviation )
select next_day('2022-02-22','MON')
--2022-02-28
reference:
Link to the original text :https://blog.csdn.net/mypowerhere/article/details/124118302
边栏推荐
- 快速实现蓝牙iBeacn功能详解
- JVM的垃圾回收机制
- 线程间等待与唤醒机制、单例模式、阻塞队列、定时器
- 高斯分布Gaussian distribution、線性回歸、邏輯回歸logistics regression
- matlab GUI界面仿真直流电机和交流电机转速仿真
- 427- binary tree (617. merge binary tree, 700. search in binary search tree, 98. verify binary search tree, 530. minimum absolute difference of binary search tree)
- Gaussian distribution, linear regression, logistic regression
- [getting started] regular expression Basics
- JVM对象组成和存储
- Dev++ 环境设置C语言关键字显示颜色
猜你喜欢

LeetCode 0086. Separate linked list

研究生数学建模竞赛-无人机在抢险救灾中的优化应用

Yaml file encryption

Quick personal site building guide using WordPress

Us camera cloud service scheme: designed for lightweight video production scenes

多线程基础部分Part2

Proxy-Reflect使用详解

JVM object composition and storage

Run opcua protocol demo on raspberry pie 4B to access kubeedge

Information System Project Manager - Chapter VII project cost management
随机推荐
TiDB 中的视图功能
tar: /usr/local:归档中找不到tar: 由于前次错误,将以上次的错误状态退出
vscode korofileheader 的配置
机 器 学 习
JVM对象组成和存储
LeetCode 0086.分隔链表
My opinion on test team construction
Configuring the help class iconfiguration in C # NETCORE
Altium Designer 19 器件丝印标号位置批量统一摆放
693. alternate bit binary number
免费的 SSH 和 Telnet 客户端PuTTY
TiDB 中的SQL 基本操作
第 299 场周赛 第四题 6103. 从树中删除边的最小分数
js实现双向数据绑定
Wholestagecodegen of spark
The risk of multithreading -- thread safety
Program ape learning Tiktok short video production
信息系统项目管理师---第七章 项目成本管理
Assembly language - Wang Shuang Chapter 11 flag register - Notes
表单校验 v-model 绑定的变量,校验失效的解决方案