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: 983
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: 518

Currently Online:
27 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6259

Newest Members:

fidelduke938316, Jan-Pfizer, DavidROunc, fen.pang@woodside.com, aytule, rashadbrownrigg, christi10l, ahamad1, Flores Frederick, ellenmoss

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1