当前位置:网站首页>Spark sql 常用时间函数
Spark sql 常用时间函数
2022-07-25 15:10: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
边栏推荐
- Add the jar package under lib directory to the project in idea
- Vs2010添加wap移动窗体模板
- 【JS高级】js之正则相关函数以及正则对象_02
- PHP implements non blocking (concurrent) request mode through native curl
- Docker上运行redis以配置文件方式启动,连接客户端报错Error: Server closed the connection
- Scala111-map、flatten、flatMap
- Award winning interaction | 7.19 database upgrade plan practical Summit: industry leaders gather, why do they come?
- Thymeleaf notes
- Spark SQL空值Null,NaN判断和处理
- Scala111-map、flatten、flatMap
猜你喜欢

Bridge NF call ip6tables is an unknown key exception handling

Share a department design method that avoids recursion

Vs2010添加wap移动窗体模板

API health status self inspection

ESXI6.7.0 升级到7.0U3f(2022年7月12 更新)

ice 100G 网卡分片报文 hash 问题

Add the jar package under lib directory to the project in idea

39 simple version of millet sidebar exercise

防抖(debounce)和节流(throttle)

树莓派入门:树莓派的初始设置
随机推荐
[Nacos] what does nacosclient do during service registration
Gbdt source code analysis of boosting
Vs2010添加wap移动窗体模板
LeetCode第 303 场周赛
LeetCode_ String_ Medium_ 151. Reverse the words in the string
CGO is realy Cool!
String type time comparison method with error string.compareto
用setTimeout模拟setInterval定时器
RedisCluster搭建和扩容
流程控制(上)
Thymeleaf notes
万能通用智能JS表单验证
PHP implements non blocking (concurrent) request mode through native curl
图片的懒加载
任务、微任务、队列和调度(动画展示每一步调用)
继承的实现过程及ES5和ES6实现的区别
mysql heap表_MySQL内存表heap使用总结-九五小庞
VS2010 add WAP mobile form template
推荐10个堪称神器的学习网站
瀑布流布局