Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Is there any timeline for java8 datetime API support?
June 22, 2018
9:56, EEST
Avatar
adamlevine
New Member
Members
Forum Posts: 1
Member Since:
June 22, 2018
sp_UserOfflineSmall Offline

Is there any timeline for java8 datetime API support?

We have spent some time recently upgrading a lot of serverside third-party libraries, as well as to Java 8.

I noticed that you could not return the new Date API classes, such as LocalDate, ZonedDateTime etc. in Datasource transfer objects, it becomes [object] in the client.

So, i was wondering if there are any plans to support the java 8 Date API, and if so, when?

June 25, 2018
10:30, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

At the moment SDK targets Java 6+, therefore we cannot use those APIs. The same goes for the underlying stack layer.

The (stack) DateTime can be converted by using DateTime.getTimeInMillis and DateTime.fromMillis to get milliseconds from the java epoch. It should be noted that the UA epoch is different and DateTime has a resolution of 100 nanoseconds (i.e. one raw increment of the internal long means +100 nanoseconds), which most of it’s api use. If you need more resolution than milliseconds, then you need to do the conversion yourself and use the constructors.

Examples:

Instant j8 = Instant.ofEpochMilli(ua.getTimeInMillis);
DateTime ua = DateTime.fromMillis(j8.toEpochMilli());

UA times are always in UTC, so the Instant can be converted to other java 8 time apis using UTC zone.

I do realise that is a bit cumbersome. And in general the whole situation is a bit tricky with Java 11 etc. coming in september and 8 being out of free support (at least from oracle) after this year. I hope we do not have to do separate builds for different versions (6-8+11), since that would complicate things alot, but if we have to do, then we could e.g. add a to/fromInstance method to DateTime to 8+ builds.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
55 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1