Converting varchar into timestamp

General

Converting varchar into timestamp

Can someone please give me the exact code to convert the following varchar data into a teradata recognised timestamp format. I have searched through existing topics but have not found an exact match for the below formats.

2016-01-07T11:52:49.113Z

and

May 25 2004  5:02:19:906AM

Please help!

Tags (1)
1 REPLY
Enthusiast

Re: Converting varchar into timestamp

sel cast(substr('2016-01-07T11:52:49.113Z',1,10)||' '||substr('2016-01-07T11:52:49.113Z',12,12) as timestamp(3))

for the first, 

for the second you can use substr also, and use a case statement to convert month to numeric value

Rglass