9:56, EEST
June 22, 2018
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?
10:30, EEST
April 3, 2012
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:
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.
Most Users Ever Online: 1919
Currently Online:
12 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: 731
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
inilarythikibia, rickykennion, PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1