Redshift Timestamp Trailing Zeros

0

Enter image description here Can anybody knows why the zeros at timestamp (eg. 2022-11-08 07:50:08.100 to 2022-11-08 07:50:08.10) are truncated by Redshift automatically? Please refer to my screenshot for details.

Ren
asked a year ago560 views
1 Answer
0

The timestamp is stored in Redshift typically would not loose the precision. Depending the tool you use to display the results of the SQL data, the formatting may be showing 2 decimal places as default unless you have more than 2 non zero decimal places.

Try this to display 3 or 6 digits:

select id,created_dt,
to_char(created_dt, 'HH24:MI:SS') as seconds,
to_char(created_dt, 'HH24:MI:SS.MS') as milliseconds,
to_char(created_dt, 'HH24:MI:SS:US') as microseconds;
profile pictureAWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions