user3461502
user3461502

Reputation: 323

DATEADD not producing same format in timestamp in Snowflake

I am running this query:

SELECT DATE_ONE, DATEADD(DAY, 7, DATE_ONE) DATE_TWO from TBLA

However, for DATE_TWO, I get the date + 7 days with three additional zeroes in the format.

enter image description here

I need DATE_TWO to be in the same format as DATE_ONE (without the additional 3 zeroes). Is there a way to do this?

Upvotes: 1

Views: 125

Answers (1)

Greg Pavlik
Greg Pavlik

Reputation: 11066

Snowflake stores timestamps with nine decimal places for fractional seconds but by default only shows three. If you want to override the default display, use to_varchar() with a format string:

select to_varchar(current_timestamp, 'YYYY-MM-DD HH:MI:SS.FF2');

Upvotes: 2

Related Questions