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
0
votes
1 answer

Get age of person with Java ThreeTen BP

I would like to find the age of a person - given his birthdate (year, month, day). How can I do this with ThreeTenBP? EDIT: One option I found is like this LocalDate birthdate = LocalDate.of(year, month, day); return (int)…
IgorGanapolsky
  • 26,189
  • 23
  • 116
  • 147
-1
votes
2 answers

error: incompatible types: Object cannot be converted to LocalDate

In my JSON response I receive the date as a timestamp value, e.g. below: "dt":1620345600 I am trying to convert this into a LocalDate using the ThreeTen BP library. I have tried to apply a TypeConverter as follows @TypeConverter @JvmStatic fun…
Murphler
  • 83
  • 1
  • 6
-2
votes
1 answer

What is the correct formatting pattern for this String format?

I am getting a DateTimeParseException when trying to convert a String to a ZonedDateTime with threeten. I am not sure what the correct formatting pattern is for this String format? 2014-04-16T00:00+02:00[Europe/Berlin]. Can someone tell me how the…
Benny
  • 839
  • 16
  • 32
-2
votes
1 answer

Convert Java.util.Calendar to org.threeten.bp.LocalDateTime (for Android)

How to convert from Android Java Date and Calendar to threeten LocalDateTime Calendar calTime = Calendar.getInstance(); Date date = calTime.getTime(); LocalDateTime ldt = Instant.ofEpochSecond(date.getTime()/1000) …
Marc
  • 442
  • 7
  • 15
-2
votes
3 answers

ZonedDateTime format to display current time with offset already included

I been looking for this answer but I could be mistaken as to how to implement this. I have a ZonedDateTime variable and currently if I were to print it it would print for example 2017-12-03T10:15:30+01:00. is there any way to print the time with the…
paul590
  • 1,385
  • 1
  • 22
  • 43
1 2 3 4 5 6
7