How to get day of week in SparkSQL?

前端 未结 3 994
半阙折子戏
半阙折子戏 2020-12-03 14:19

I am trying to select all record recorded at Sunday through SparkSQL. I have the following try but in vain.

SELECT * FROM mytable WHERE DATEPART(WEEKDAY, cre         


        
3条回答
  •  囚心锁ツ
    2020-12-03 15:08

    SPARK 1.5.0 has a date_format function that accepts a format as an argument. This format returns a name of a week day from a timestamp:

    select date_format(my_timestamp, 'EEEE') from ....

    Result: e.g. 'Tuesday'

提交回复
热议问题