Categories: Date/Time
NEXT_DAY
Returns the date or timestamp of the first specified day of week that occurs after the input date.
Syntax
NEXT_DAY(date_timestamp_expression string, day_of_week string) → date
- date_timestamp_expression: A
DATEorTIMESTAMPexpression. - day_of_week: A string expression identifying a day of the week. The value can be a string literal or an expression that returns a string. The string must be one of the following (case-sensitive):
SU,SUN,SUNDAYMO,MON,MONDAYTU,TUE,TUESDAYWE,WED,WEDNESDAYTH,THU,THURSDAYFR,FRI,FRIDAYSA,SAT,SATURDAY
Examples
NEXT_DAY exampleSELECT NEXT_DAY('2015-01-14 12:05:55', 'TU')
-- 2015-01-20
SELECT pickup_datetime, NEXT_DAY(pickup_datetime, 'FRIDAY') AS "next_day"
FROM Samples."samples.dremio.com"."NYC-taxi-trips"
LIMIT 3
-- pickup_datetime, next_day
-- 2013-05-27 19:15:00.000, 2013-05-31
-- 2013-05-31 16:40:00.000, 2013-06-07
-- 2013-05-27 19:03:00.000, 2013-05-31
Usage Notes
The return value is always a date regardless of whether date_timestamp_expression is a date or a timestamp.