1

I have timestamp stored in VARCHAR field in the format Tue Jul 28 04:05:16 PDT 2020. Can I cast it to a timestamp(0) field in Teradata ?

pats4u
  • 103
  • 3
  • 12
  • Is the format of the VarChar always the same fixed length? – dnoeth Aug 24 '20 at 10:09
  • Yes. Length & Format is expected to be same always. Thanks – pats4u Aug 24 '20 at 11:10
  • 1
    Teradata doesn't recognize time zone descriptors like PDT; you would have to remove / adjust for that with a CASE statement or UDF. If it's always literally the letters PDT (and never PST or EDT, for example) then `to_timestamp(fld, 'dy mon dd "PDT" hh24:mi:ss yyyy')` should work. But CAST won't like the day of week or having the time between the month/day and year (in addition to the time zone descriptor issue); you'd have to SUBSTRING and concatenate to rearrange the components. – Fred Aug 25 '20 at 00:05
  • Another question, can you check if PDT is only used for the daylight saving part (summer) and PST for the rest (winter). – dnoeth Aug 25 '20 at 13:09

0 Answers0