'Why time format is changing in Azure Databricks
I have a file with a timestamp with time format as 2017-01-20 16:53:05.212
(yyyy-MM-dd HH:mm:ss.SSS
).
I have uploaded this file to Azure data lake gen 2 and accessed that file into Azure Databricks.
But when I have executed the below simple query in Databricks notebook.
Time format was getting changed to 2017-01-20T16:53:05.212+0000
(yyyy-MM-dd'T'HH:mm:ssZZZZ
).
query:
Select * from dsd_file_temp
I don't want to change my time format.
Solution 1:[1]
The default timestamp format in Azure databricks includes the time-zone.
You can use date_format() to get the required value.
select date_format(to_timestamp('2017-01-20 16:53:05.212'),'yyyy-MM-dd HH:mm:ss.SSS') as dt2;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |