This code snippet shows how to convert string to date.

In Scala, java.text.SimpleDateFormat class can be used to to convert string to Date object with user provided date format.

Code snippet

import java.text.SimpleDateFormat
import java.util.Date

val format = new SimpleDateFormat("yyyy-MM-dd")
val date = format.parse("2018-03-03")

info Last modified by Raymond at 2 years ago copyright This page is subject to Site terms.

More from Kontext

local_offer spark local_offer pyspark local_offer how-to local_offer tutorial

visibility 2
thumb_up 0
access_time 1 hour ago

This article shows you how to filter NULL/None values from a Spark data frame using Python. Function DataFrame.filter or DataFrame.where can be used to filter out null values.

open_in_new Spark

local_offer tutorial local_offer spark local_offer how-to

visibility 5
thumb_up 0
access_time 18 hours ago

Spark is a robust framework with logging implemented in all modules. Sometimes it might get too verbose to show all the INFO logs. This article shows you how to hide those INFO logs in the console output. Spark logging level Log level can be setup using function pyspark.Spar...

open_in_new Spark

local_offer tutorial local_offer pyspark local_offer spark local_offer how-to

visibility 4
thumb_up 0
access_time 19 hours ago

This article shows how to change column types of Spark DataFrame using Python. For example, convert StringType to DoubleType, StringType to Integer, StringType to DateType. Construct a dataframe  Follow article  ...

open_in_new Spark

local_offer tutorial local_offer pyspark local_offer spark local_offer how-to

visibility 5
thumb_up 0
access_time 19 hours ago

This article shows how to add a constant or literal column to Spark data frame using Python.  Construct a dataframe  Follow article  Convert Python Dicti...

open_in_new Spark

comment Comments (0)

comment Add comment

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

No comments yet.

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.


Learn more arrow_forward