当前位置:网站首页>Spark SQL common time functions
Spark SQL common time functions
2022-07-25 15:15: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
边栏推荐
- TypeScript学习1——数据类型
- sql server强行断开连接
- Deployment and simple use of PostgreSQL learning
- SPI传输出现数据与时钟不匹配延后问题分析与解决
- mysql heap表_MySQL内存表heap使用总结-九五小庞
- Spark002---spark任务提交,传入json作为参数
- 6线SPI传输模式探索
- The implementation process of inheritance and the difference between Es5 and ES6 implementation
- 处理ORACLE死锁
- When using jetty to run items, an error is reported: form too large or form too many keys
猜你喜欢

从 join on 和 where 执行顺序认识T-sql查询执行顺序

【JS高级】js之正则相关函数以及正则对象_02

Nacos2.1.0 cluster construction

oracle_ 12505 error resolution

Docker上运行redis以配置文件方式启动,连接客户端报错Error: Server closed the connection

VMware Workstation fails to start VMware authorization service when opening virtual machine

Leo-sam: tightly coupled laser inertial odometer with smoothing and mapping

Overview of JS synchronous, asynchronous, macro task and micro task

用setTimeout模拟setInterval定时器

反射-笔记
随机推荐
延迟加载源码剖析:
node学习
SublimeText-win10光标跟随问题
Universal smart JS form verification
ESXI6.7.0 升级到7.0U3f(2022年7月12 更新)
Es5 thinking of writing inheritance
从 join on 和 where 执行顺序认识T-sql查询执行顺序
Spark SQL空值Null,NaN判断和处理
oracle_12505错误解决方法
"Ask every day" how locksupport realizes thread waiting and wakeup
Sublimetext-win10 cursor following problem
Spark提交参数--files的使用
How much memory can a program use at most?
Simulate setinterval timer with setTimeout
Instance Tunnel 使用
Browser workflow (Simplified)
打开虚拟机时出现VMware Workstation 未能启动 VMware Authorization Service
流程控制(上)
Hbck 修复问题
Leo-sam: tightly coupled laser inertial odometer with smoothing and mapping