extract date value in format YYYYMMDDHHMMSS

UDA
Enthusiast

extract date value in format YYYYMMDDHHMMSS

Hi,

This probably might be an easy thing to do, however I'm still not that much of an expert at this, so I would like to ask your help. I have a field of type date in one column of a table and I want to select that field, but the format must be, 14 characters - YYYYMMDDHHMMSS (e.g. 20090215142931)

I have tried:
select field (format 'YYYYMMDDHHMMSS') (CHAR(14))

and

select field (format 'YYYYMMDDHHMISS') (CHAR(14))

But did not get the data successfully. Should I be using cast? or Is the format I'm using wrong?

Please advise. Thanks!
2 REPLIES
Teradata Employee

Re: extract date value in format YYYYMMDDHHMMSS

Hello,

Try by casting it to TIMESTAMP(0).

Regards,

Adeel
Enthusiast

Re: extract date value in format YYYYMMDDHHMMSS

that worked! thanks a lot! :)