Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 09:00 AM
Does anyone know how to change the format of a date like this
Dec 17 2016 8:22PM |
into yyyy-MM-dd hh:mm:ss?
Thanks
Labels:
- Labels:
-
Spark
1 ACCEPTED SOLUTION
Accepted Solutions
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 11:44 AM
Convert to timestamp first and then format to string
select date_format(to_timestamp('Dec 17 2016 8:22PM', 'MMM dd yyyy h:ma'), "yyyy-MM-dd HH:mm:ss")
Here is the documentation for this:
https://docs.databricks.com/en/sql/language-manual/sql-ref-datetime-pattern.html
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023 11:44 AM
Convert to timestamp first and then format to string
select date_format(to_timestamp('Dec 17 2016 8:22PM', 'MMM dd yyyy h:ma'), "yyyy-MM-dd HH:mm:ss")
Here is the documentation for this:
https://docs.databricks.com/en/sql/language-manual/sql-ref-datetime-pattern.html

