Lehel Boér created NIFI-12866:
---------------------------------

             Summary: DataTypeUtils long to Timestamp conversion may not handle 
historical dates correctly
                 Key: NIFI-12866
                 URL: https://issues.apache.org/jira/browse/NIFI-12866
             Project: Apache NiFi
          Issue Type: Bug
            Reporter: Lehel Boér
            Assignee: Lehel Boér


* NiFi version: 1.25.0
 * Slack discussion: 
https://apachenifi.slack.com/archives/C0L9VCD47/p1709571300887339

When inserting default time -62135596800000 (0001-01-01) from NiFi to 
PostgreSQL, it results in 0001-01-03.

The conversion happens in DataTypeUtils::toTimeStamp.

 

 
{code:java}
if (value instanceof Number) {
    final long longValue = ((Number) value).longValue();
    return new Timestamp(longValue);
} {code}
 

 

When Java created a new Timestamp, it constructs a Date object internally.

When creating a Date object witht he same value it is also shifted.
{code:java}
Date date = new Date(-62135596800000L);

1-01-02T19:00:00.000-0500" {code}
 

This issue needs to be investigated.

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to