当前位置:网站首页>Spark-SQL中根据年月日显示周几用date_format(date,‘u‘)
Spark-SQL中根据年月日显示周几用date_format(date,‘u‘)
2022-07-26 01:25:00 【大数据小王】
====SparkSQL中
select date_format(now(),'u')
select date_format('2022-07-02','u')
结果==》6
select date_format('2022-07-03','u')
结果==》7
select date_format('2022-07-04','u')
结果==》1
select date_format('2022-07-05','u')
结果==》2
select date_format('2022-07-06','u')
结果==》3
select date_format('2022-07-07','u')
结果==》4
select date_format('2022-07-08','u')
结果==》5注意:
select date_format('2022-07-02','u')
结果==》6
date_format(date,'u')函数hivesql和sparksql均支持,但是mysql和doris以及prestosql均不支持
例:
select instr("abc", "b");
结果==》2
select date_format('2022-07-22','u')
结果==》5
select instr('1-2-3-4-5-6-7',date_format('2022-07-22', 'u'))
结果==》9
select instr('1-2-3-4-5-6-7',date_format('2022-07-22', 'u'))>0
结果==》true
边栏推荐
猜你喜欢

NodeJS 基于 Dapr 构建云原生微服务应用,从 0 到 1 快速上手指南

Basic version of Google browser debugging tool (I)
![[software development specification III] [software version naming Specification]](/img/dd/86f3323591ec688d6828d7075db59d.png)
[software development specification III] [software version naming Specification]

Leetcode537. Complex multiplication (yes, solved)

Cross linguistic transfer of correlations between parts of speech and Gazette Features Reading Notes

Format JS code and debug JS code

The application and principle of changing IP software are very wide. Four methods of dynamic IP replacement are used to protect network privacy

Web middleware log analysis script 3.0 (shell script)

链表相关面试题

NIO简易示例
随机推荐
[software development specification III] [software version naming Specification]
Easyrecovery15 data recovery software with high recovery rate and high download volume
[Go]三、最简单的RestFul API服务器
Handler message mechanism - FWK layer
NiO simple example
当博客被黑客攻击时该怎么办?
4QAM、16QAM 调制与解调仿真电路,观察并分析QAM星座图和误码率曲线【matlab代码】
NodeJS 基于 Dapr 构建云原生微服务应用,从 0 到 1 快速上手指南
[CTF] crypto preliminary basic outline
数据库系统原理与应用教程(057)—— MySQL 练习题
What is the dynamic IP address? Why do you recommend dynamic IP proxy?
[ickim 2022] the Fourth International Conference on knowledge and information management
Oracle is nested at multiple levels, and the alias problem of the table cannot be found
Arthas watch 命令查看数组中对象的属性
[secsha concept] large and small end
poj1521
3059. 雕塑(jzoj)
Sqli-labs Less7
网络文件传输之零拷贝
如何获取广告服务流量变现数据,助力广告效果分析?