- Get backport-util-concurrent.jar from nexus
<dependency>
<groupid>backport-util-concurrent</groupid>
<artifactid>backport-util-concurrent</artifactid>
<version>3.1</version>
</dependency>
- code snippet
import java.util.concurrent.TimeUnit;
long timeInMillis = System.currentTimeMillis();
- You can use query to get the DB time
select extract(day from(systimestamp - to_timestamp('1970-01-01', 'YYYY-MM-DD'))) * 86400000 + to_number(to_char(sys_extract_utc(systimestamp), 'SSSSSFF3')) current_time_milliseconds
from dual;
- Timestamp dbTimeStamp = result of above quey...
dbTimeStamp.setNanos((int) (nanos % 1000000000));
No comments :