Getting day of week from date column in prestosql?

10,638

You can use the format_datetime function to extract the day of week from a date or timestamp:

SELECT format_datetime(day, 'E')
FROM (
  VALUES DATE '2019-07-22'
) t(day)

produces:

 _col0
-------
 Mon

If you want the full name of the day, use format_datetime(day, 'EEEE'):

 _col0
-------
 Monday
Share:
10,638

Related videos on Youtube

Chris90
Author by

Chris90

Updated on June 04, 2022

Comments

  • Chris90
    Chris90 almost 2 years

    I have a date column called day such as 2019/07/22 if I want to create a custom field that translates that date to the actual day of week it is such as Sunday or Monday how is this possible? I cant seem to find a method that works for presto sql.

    Thanks for looking