sql - Parse Decimal Second by PostgreSQL -
i parse string
'16:25:20.6598412z'
as timestamp without time zone
the function use is:
to_timestamp('16:25:20.6598412z', 'hh24:mi:ss.msus')
but result is:
16:25:21.5002+01
this have not same time:
16:25:20.6598412
you cannot use ms
, us
both in 1 to_timezone
call - microseconds miliseconds (and little more) how engine know how parse string?
instead should use
to_timestamp('16:25:20.6598412z', 'hh24:mi:ss.us')
also notice microseconds
due reference value in range of (000000-999999) can pass 6 digits us
to_timestamp('16:25:20.659841z', 'hh24:mi:ss.us')
to loose timezone add ::timestamp without time zone;
@ end of to_timestamp
call
to_timestamp('16:25:20.6598412z', 'hh24:mi:ss.msus')::timestamp without time zone;
Comments
Post a Comment