当前位置:网站首页>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
边栏推荐
- System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
- QT connect, signal, slot and lambda comparison
- Sublimetext-win10 cursor following problem
- Meanshift clustering-01 principle analysis
- JS 同步、异步,宏任务、微任务概述
- 45padding won't open the box
- [C topic] force buckle 876. Intermediate node of linked list
- "How to use" agent mode
- When using jetty to run items, an error is reported: form too large or form too many keys
- "Ask every day" reentrantlock locks and unlocks
猜你喜欢

bridge-nf-call-ip6tables is an unknown key异常处理

Award winning interaction | 7.19 database upgrade plan practical Summit: industry leaders gather, why do they come?

Implement a simple restful API server

一个程序最多可以使用多少内存?

spark分区算子partitionBy、coalesce、repartition

流程控制(上)

图片裁剪cropper 示例

Visual Studio 2022 查看类关系图

Unable to start web server when Nacos starts

【JS高级】js之正则相关函数以及正则对象_02
随机推荐
BigDecimal rounds the data
一个程序最多可以使用多少内存?
[Android] recyclerview caching mechanism, is it really difficult to understand? What level of cache is it?
6月产品升级观察站
任务、微任务、队列和调度(动画展示每一步调用)
L1 and L2 regularization
"Ask every day" briefly talk about JMM / talk about your understanding of JMM
Boosting之GBDT源码分析
Pl/sql creates and executes ORALCE stored procedures and returns the result set
"How to use" agent mode
"Ask every day" what is volatile
防抖(debounce)和节流(throttle)
我的创作纪念日
vscode 插件篇收集
C, c/s upgrade update
[Nacos] what does nacosclient do during service registration
PHP implements non blocking (concurrent) request mode through native curl
在win10系统下使用命令查看WiFi连接密码
LeetCode第 303 场周赛
Universal smart JS form verification