当前位置:网站首页>How sparksql returns a specific day of the week by date -dayofweek function

How sparksql returns a specific day of the week by date -dayofweek function

2022-06-26 17:21:00 Big data Xiao Wang

dayofweek Function returns the workday index value of the date , That is, Sunday is 1, Monday 2, Think of six for 7

And how to turn the common Monday into 1, Zhou Erwei 2, Wednesday is 3,... Zhou 6 position 6, Sunday is 7

select if((dayofweek('2022-06-23')-1)%7=0,7,(dayofweek('2022-06-23')-1)%7);

select dayofweek('2022-06-23')

 

 

原网站

版权声明
本文为[Big data Xiao Wang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261652167789.html