当前位置:网站首页>Spark sql 常用时间函数
Spark sql 常用时间函数
2022-06-27 06:18:00 【南风知我意丿】
List function
current_date() 当前日期
select current_date();
--2022-02-22
- now() 或 current_timestamp() 当前时间
select now();
select current_timestamp();
--2022-02-22 22:22:22
- datediff(endDate, startDate) 日期相差天数
select datediff('2022-02-22','2022-02-20');
--2
- months_between(endDate, startDate) 日期相差月数
select months_between('2022-06-16','2022-02-12');
--4.12903226
- date_add(startDate, numDays) 日期加N天
select date_add('2022-02-22',3)
--2022-02-25
select date_add('2022-02-22',-3)
--2022-02-19
- date_sub(startDate, numDays) 日期减N天
select date_sub('2022-02-22',3)
--2022-02-19
select date_sub('2022-02-22',-3)
--2022-02-25
- add_months(startDate, numMonths) 日期加N月
select add_months('2022-02-22',3);
--2022-05-22
select add_months('2022-02-22',-3);
--2021-11-22
- last_day(date) 日期所在月份的最后一天
select last_day('2022-02-22');
--2022-02-28
- next_day(startDate, dayOfWeek) 指定日期后的第一个星期几(星期参数为英文缩写)
select next_day('2022-02-22','MON')
--2022-02-28
reference:
原文链接:https://blog.csdn.net/mypowerhere/article/details/124118302
边栏推荐
- 【QT小记】QT中正则表达式QRegularExpression的基本使用
- 浅谈GPU:历史发展,架构
- Spark's projection
- 使用 WordPress快速个人建站指南
- Cloud-Native Database Systems at Alibaba: Opportunities and Challenges
- 汇编语言-王爽 第8章 数据处理的两个基本问题-笔记
- Assembly language - Wang Shuang Chapter 13 int instruction - Notes
- 310. 最小高度树
- The restart status of the openstack instance will change to the error handling method. The openstack built by the container restarts the compute service method of the computing node and prompts the gi
- 卷积神经网络---CNN模型的应用(找矿预测)
猜你喜欢
随机推荐
[QT dot] realize the watchdog function to detect whether the external program is running
JVM tuning ideas
Sqlsever 字段相乘后保留2位小数
Altium designer 19 device silk screen label position shall be placed uniformly in batches
JVM garbage collection mechanism
How win 10 opens the environment variables window
EasyExcel:读取Excel数据到List集合中
Proxy-Reflect使用详解
Block level elements & inline elements
研究生数学建模竞赛-无人机在抢险救灾中的优化应用
多线程基础部分Part3
Distribution gaussienne, régression linéaire, régression logistique
Run opcua protocol demo on raspberry pie 4B to access kubeedge
Matlab quickly converts two-dimensional coordinates of images into longitude and latitude coordinates
426 binary tree (513. find the value in the lower left corner of the tree, 112. sum of paths, 106. construct a binary tree from the middle order and post order traversal sequence, 654. maximum binary
Active learning
IDEA中关于Postfix Completion代码模板的一些设置
汇编语言-王爽 第11章 标志寄存器-笔记
Database - index
thrift








