当前位置:网站首页>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
边栏推荐
- The application and principle of changing IP software are very wide. Four methods of dynamic IP replacement are used to protect network privacy
- Advanced C language (I) dynamic memory allocation
- PtGui pro12 vertical line correction
- 快速创建题目文件夹
- 推荐⼀款超好⽤的UI⾃动化⼯具: UiAutomator2!
- U++ learning notes ustruct, uenum declaration and function library simple function implementation
- Matlab bitwise and or not
- How to obtain the cash flow data of advertising services to help analyze the advertising effect?
- Nodejs builds cloud native microservice applications based on dapr, a quick start guide from 0 to 1
- 第二届中国Rust开发者大会来啦,完整议程大曝光!
猜你喜欢

Half of the people in the country run in Changsha. Where do half of the people in Changsha run?

Detailed explanation of redis data structure, combined with books

Linear relationship between vectors

What should I do when my blog is attacked by hackers?

Tencent employees' salary: the real 985 graduation salary, do you think I can be saved? Netizen: daily salary?

推荐⼀款超好⽤的UI⾃动化⼯具: UiAutomator2!

聚势|海泰方圆亮相第五届数字中国建设峰会
![[Go]三、最简单的RestFul API服务器](/img/1f/f6fc8cc9a3891d01a25e709170188d.png)
[Go]三、最简单的RestFul API服务器

Web middleware log analysis script 3.0 (shell script)

PTGui Pro12垂直线纠正
随机推荐
Mulda: a multilingual data augmentation framework for low resource cross linguistic ner reading notes
PyCharm在创建py文件时自动添加头部注释
Iftnews | suppose this is what the metauniverse looks like 20 years later
数据库系统原理与应用教程(056)—— MySQL 查询(十八):其他类型函数的用法
电视机软件烧录
What if win11 cannot open its own anti-virus software? Win11's built-in anti-virus function cannot be turned on
数据库系统原理与应用教程(054)—— MySQL 查询(十六):日期时间型函数的用法
Kubernetes pod start process
当博客被黑客攻击时该怎么办?
Tencent employees' salary: the real 985 graduation salary, do you think I can be saved? Netizen: daily salary?
Causes of signal degradation in optical fiber communication
Zombie‘s Treasure Chest(枚举)
Prime Ring Problem
The gym closes 8000 stores a year. How does the studio that bucks the trend and makes profits open?
SOC first project hello_ world
Mysql_ Note1
4QAM、16QAM 调制与解调仿真电路,观察并分析QAM星座图和误码率曲线【matlab代码】
Machine learning: Bayesian Networks
8. Learn Mysql to create data tables
[software development specification II] prohibited item development specification