KxSystems / javakdb

Using Java with kdb+
https://code.kx.com/q/interfaces
Apache License 2.0
52 stars 45 forks source link

java.time.* #56

Closed plemanach closed 1 year ago

plemanach commented 3 years ago

Hello,

is there any plan to replace these deprecated types :

import java.util.date; import java.sql.Date; import java.sql.Time; import java.sql.Timestamp;

https://www.baeldung.com/java-8-date-time-intro

Current Java types Proposed Java 8 types
java.sql.Date java.time.LocalDate
java.sql.Time java.time.LocalTime
java.sql.Timestamp java.time.Instant
java.util.Date java.time.LocalDateTime

The main concern with the current old java type is the fact the epoch is altered to show the UTC date/time with the local hidden time zone from java.util.date.

`long getTzOffset(long x){ return tz.getOffset(x); }

long lg(long x){ return x+getTzOffset(x); } long gl(long x){ return x-getTzOffset(x-getTzOffset(x)); }`

so you cannot use java.util.Date.toInstant() to get the accurate epoch.

I created a pull request to show how that could work : #57

Best Regards,

Patrice

sshanks-kx commented 1 year ago

Changes now in master branch for forthcoming release. Thanks for previous PR.