Questions tagged [threetenbp]

ThreeTen-Backport is the backport of JSR-310 to Java SE 7. Questions about "java.time" in Java SE 8 should use the [java-time] tag. Only questions specifically about the backport should use this tag.

ThreeTen-Backport is the backport of JSR-310 to Java SE 7. Questions about java.time in Java SE 8 should use the tag. Only questions specifically about the backport should use this tag.

95 questions
1
vote
2 answers

How to fix org.threeten.bp.format.DateTimeParseException?

I am converting UTC time into local time and I facing the error: org.threeten.bp.format.DateTimeParseException: Text 'Wed Oct 17 06:12:19 GMT+05:30 2018' could not be parsed at index 20 Please say any other options or fix this solution.. This…
Bala sundar k
  • 17
  • 1
  • 7
1
vote
0 answers

How to calculate minutes of the day from a UTC milliseconds value w/o time zone offset?

Given the following time stamp ... 2018-09-07T17:00:00+02:00 which corresponds to .. UTC: 1536332400000 milliseconds I like to calculate the amount of minutes of the day using the ThreeTen backport library: val dateUtc = 1536332400000L val offset…
JJD
  • 50,076
  • 60
  • 203
  • 339
1
vote
1 answer

Threeten DateTimeParseException for OffsetDateTime.parse(String,dateTimeFormatter)

I would like to simply make a DateTimeFormatter to be used in OffsetDateTime parser. But I get DateTimeParseException: final DateTimeFormatter ISO_LOCAL_DATE; ISO_LOCAL_DATE = new DateTimeFormatterBuilder() .appendValue(YEAR, 4, 10,…
user737862
  • 51
  • 8
1
vote
1 answer

Convert java.time classes from java 8 to java 5

What do I do to use this lines of code with Java 5, as this code runs with Java 6 and 7 using threetenbp and runs on Java 8 directly: // start date (set the time to start of day) ZonedDateTime from =…
Wasfy
  • 73
  • 8
1
vote
2 answers

Can you directly map ISO 8601 timestamps into OffsetDateTime or ZonedDateTime with Retrofit 2 and Gson?

On Android, using Retrofit 2 and its Gson converter, you can map ISO 8601 strings like "2016-10-26T11:36:29.742+03:00" (in backend's JSON response) directly into java.util.Date fields in a POJO. This works neatly out of the box. Now, I'm taking the…
Jonik
  • 80,077
  • 70
  • 264
  • 372
1
vote
1 answer

How to parse threeten DateTIme

I am trying to parse this DateTime: DateTimeFormatter dateTimeFormatter = new DateTimeFormatterBuilder() .appendPattern("dd/MM/yyyy hh:mm:ss") .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0) …
Leandro Borges Ferreira
  • 12,422
  • 10
  • 53
  • 73
1
vote
2 answers

Gradle - Use other version of dependency in Unit Tests

In a pure Java module, I have a dependency to compile group: 'org.threeten', name: 'threetenbp', version: threeTenVersion, classifier: 'no-tzdb'. I'm using the no-tzdb variant because this module will be used inside an Android app and the the tzdb…
pdegand59
  • 12,776
  • 8
  • 51
  • 58
1
vote
0 answers

ZonedDateTime.now() causes org.threeten.bp.zone.ZoneRulesException

I just found this library to use java.time from Java 8 on Android. In my TimePickerDialog I ask for a time, and after that I have to send a HTTP request to a server with a Date object in it (with the time from the dialog), in this format:…
logi0517
  • 813
  • 1
  • 13
  • 32
1
vote
0 answers

Rewriting all java.time uses to ThreeTen-Backport

Retrolambda allows conversion of Java 8 class files to Java 7 format (and before). It explicitly doesn't backport Java 8 APIs. If I want to also replace all references to java.time.* with corresponding org.threeten.bp.* API, is there a way to do so?…
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
1
vote
2 answers

Java: Setting the timezone from within an OSGi application

My embedded Java application running on Linux should allow the user to change the timezone through a GUI. My application is running in an OSGI container (see below why I believe this is relevant) and should not need to restart before using the new…
Philipp
  • 4,659
  • 9
  • 48
  • 69
0
votes
1 answer

Error org.threeten.bp.format.DateTimeParseException

I know that there is a lot of similar questions like this but cant apply these solutions on them. i am trying to transform date that i am getting from server int this format: 2019-07-26T02:39:32.4053394 and then i am trying to convert it to…
gojic
  • 363
  • 7
  • 20
0
votes
1 answer

Creating typeconvertor to convert Int timestamp to LocalDate

What would be the best way to go about this. I am using 2 different APIs and one returns a date as a String and the other returns date as an Int timestamp in the format of e.g. 162000360 I was using the ThreeTen backport for Date/Time classes. I…
Murphler
  • 83
  • 1
  • 6
0
votes
1 answer

Android error "org.threeten.bp.temporal.UnsupportedTemporalTypeException: Unsupported unit: Seconds"

I am using the 'com.jakewharton.threetenabp:threetenabp:1.2.4' library for using Newer features DateTimeFormatter for lower apis version. I have a situation where I have to first convert the the date from the JSON response which is in…
0
votes
1 answer

Parse Date String Return Wrong Month

I try to parse date string but always get wrong month. Here's my code. This is code to select date from calender @OnClick(R.id.tedit_tgllahir_addnew) void showTimeDialog(){ calendar = Calendar.getInstance(); year =…
Tiramochi
  • 1
  • 2
0
votes
2 answers

How to modify decimal fractions from UTC Date Time to Date

I'm trying to convert a utc date time in local date time, but I have some problem the the decimal fraction. I call a web service the return a series of data. One of these data is the utc date time in this format I must the use this library…
Scripta14
  • 463
  • 2
  • 8
  • 22