Teradata SQL numeric to timestamp or date

615 Views Asked by At

I need to change a column that looks like this =" 202007211330231166 " into time stamp or date format = 21/07/2020 & time = 1:30 pm i.e. (1330 <- part) Help. I was attempting to use Substring to capture the date & time sections.

select InfoData from dbc.dbcinfoV where InfoKey = 'RELEASE'; = version of Teradata 16.20.53.13

1

There are 1 best solutions below

0
On

You're on the right track, split the string and then CAST it:

cast(substring(col from 1 for 8) as date format 'yyyymmdd')
cast(substring(col from 9 for 4) as time(0) format 'hhmi')