I have a source table click
with a column named click_date
whose datatype is varchar
, it contains values with two different format of dates in the same column. For example:
Jul 17 2018 4:54PM
2019-02-05 08:20:29.000
I have a target table named click
and I need to map the data into it in a column named click_date
whose datatype is bigint
.
So it is throwing an error while doing casting
Tried the below :
td_time_parse(cast(cast(click_date as timestamp)as varchar))
But it doesn't solve both the formats.. I need to convert both the date formats into integer so that it can be loaded into the target.
note that target data type cannot be changed and it is bigint. Фny leads will be appreciated.
You could use a combination of
date_parse
andto_unixtime
to convert your date in varchar into a unixtimestamp (which is in double datatype).for date format: 2019-02-05 08:20:29.000
for date format: Jul 17 2018
This will return you a double datatype of your date which you can store it in your database.