Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Cast( question.
Tue, Oct 9 2018 6:36 PMPermanent Link

Ian Branch

Avatar

Hi Team,
   I am trying to cast the current timestamp to a formatted string.
{sql}
   CAST(Current_TIMESTAMP AS VARCHAR(14) FORMAT "YYYYMMDDHHmmss")
{sql}
   Not having much luck.  I have tried several permutations but no luck att.
   
   Appreciate being educated on how to do this properly.

Regards & TIA,
Ian
Wed, Oct 10 2018 3:11 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian

Try

CAST(CURRENT_TIMESTAMP AS VARCHAR(14) DATE FORMAT 'YYYYMMDD' TIME FORMAT 'HHmmss')

It looks like there's a space between the date & time portions so you may want to do this

REPLACE(' ','',CAST(CURRENT_TIMESTAMP AS VARCHAR(14) DATE FORMAT 'YYYYMMDD' TIME FORMAT 'HHmmss'))

Roy Lambert
Wed, Oct 10 2018 6:41 PMPermanent Link

Ian Branch

Avatar

Ah Ha!  Tks Roy.
Image