SparkR (version 2.1.2)

next_day: next_day

Description

Given a date column, returns the first date which is later than the value of the date column that is on the specified day of the week.

Usage

next_day(y, x)

# S4 method for Column,character next_day(y, x)

Arguments

y

Column to compute on.

x

Day of the week string.

Details

For example, next_day('2015-07-27', "Sunday") returns 2015-08-02 because that is the first Sunday after 2015-07-27.

Day of the week parameter is case insensitive, and accepts first three or two characters: "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun".

See Also

Other datetime_funcs: add_months, date_add, date_format, date_sub, datediff, dayofmonth, dayofyear, from_unixtime, from_utc_timestamp, hour, last_day, minute, months_between, month, quarter, second, to_date, to_utc_timestamp, unix_timestamp, weekofyear, window, year

Examples

Run this code
# NOT RUN {
next_day(df$d, 'Sun')
next_day(df$d, 'Sunday')
# }

Run the code above in your browser using DataLab