SparkR (version 2.1.2)

date_format: date_format

Description

Converts a date/timestamp/string to a value of string in the format specified by the date format given by the second argument.

Usage

date_format(y, x)

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

Arguments

y

Column to compute on.

x

date format specification.

Details

A pattern could be for instance

dd.MM.yyyy

and could return a string like '18.03.1993'. All pattern letters of java.text.SimpleDateFormat can be used.

Note: Use when ever possible specialized functions like year. These benefit from a specialized implementation.

See Also

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

Examples

Run this code
# NOT RUN {
date_format(df$t, 'MM/dd/yyy')
# }

Run the code above in your browser using DataCamp Workspace