Reputation: 1
One of my nifi process is taking data from JSON object and inserting it in postgres table. I'm currently facing an issue with inserting default time -62135596800000 (0001-01-01) from NiFi to PostgreSQL. I've noticed that when the data is inserted, there's an unexpected addition of 2 days, resulting in the date showing up as 0001-01-03 in PostgreSQL.
Can someone help me in understanding the root cause for this? Please note that nifi internally converts epoch to UTC while inserting data from JSON to postgres, I am not doing any conversion in nifi process.
Edit:
Here is an example (I have attached screenshots):
Upvotes: 0
Views: 84
Reputation: 1
Something in your system is probably doing a time zone or other conversion.
As a test in psql:
SET TIME ZONE 'UTC';
--Make sure the TZ is set to UTC;
select extract(EPOCH from '01/01/0001 00:00'::timestamp);
--My system returned -62135596800 - Note that this
--EPOCH is slightly different than yours
select to_timestamp(-62135596800);
--Returned 0001-01-01 00:00:00.000000 +00:00
Upvotes: 0