Timestamp with precision output format with trailing zeros

Started by Eugene Podshivalovover 4 years ago2 messagesgeneral
Jump to latest
#1Eugene Podshivalov
yaugenka@gmail.com

Hi,

# select '2022-01-06 18:00:00.000+03'::timestamptz(3);
timestamptz
------------------------
2022-01-06 18:00:00+03

Would it be more correct to output zero milliseconds if the column has
precision defined?

Regards,
Eugene

#2Erik Wienhold
ewie@ewie.name
In reply to: Eugene Podshivalov (#1)
Re: Timestamp with precision output format with trailing zeros

Hi Eugene,

# select '2022-01-06 18:00:00.000+03'::timestamptz(3);
timestamptz
------------------------
2022-01-06 18:00:00+03

Would it be more correct to output zero milliseconds if the column has
precision defined?

Only significant fractional are printed, e.g. with milliseconds > 0:

# select '2022-01-06 18:00:00.001+03'::timestamptz(3);
timestamptz
----------------------------
2022-01-06 16:00:00.001+01

I don't know if omitting trailing zeros is intended but it makes sense to
me.

Erik