Reputation: 2876
everything is in the title. I tried this without success so far:
date_format(to_date(col("data")["createdAt"], 'E, d M y HH:mm:ss x'), 'yyyy-mm-dd')
all values returned are null
This is an example of input Fri, 12 Jun 20 07:49:17 +0000
Upvotes: 0
Views: 356
Reputation: 42352
to_date
does not accept weekdays (E
), so you need to remove that using split
first. Also you need to fix the formats (note capitalization):
date_format(to_date(split(col("data")["createdAt"], ', ')[1], 'd MMM yy HH:mm:ss Z'), 'yyyy-MM-dd')
Upvotes: 1