Skip to content

Date and Time Functions

to_date

to_date(
  e: Column): Column
to_date(
  e: Column,
  fmt: String): Column

to_date converts the column into DateType (by casting to DateType).

Note

fmt follows the formatting styles.

Internally, to_date creates a Column with ParseToDate expression (and Literal expression for fmt).

Tip

Use ParseToDate expression to use a column for the values of fmt.

to_timestamp

to_timestamp(
  s: Column): Column
to_timestamp(
  s: Column,
  fmt: String): Column

to_timestamp converts the column into TimestampType (by casting to TimestampType).

Note

fmt follows the formatting styles.

Internally, to_timestamp creates a Column with ParseToTimestamp expression (and Literal expression for fmt).

Tip

Use ParseToTimestamp expression to use a column for the values of fmt.