Questions tagged [zoneddatetime]

`ZonedDateTime` is a standard Java class representing a “date-time with a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00 Europe/Paris.”

339 questions
-2
votes
1 answer

ZonedDateTime localization

I need to output ZonedDateTime according to the locale I get later. Is there any way I can convert the ZonedDateTime value to the required format? ZonedDateTime creationDate=ZonedDateTime.now(); //convert creationDate depending on the existing…
Ckafff
  • 3
  • 2
-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

LocalDate and LocalDateTime depend on ZonedDateTime

Why are the methods: public ZonedDateTime atStartOfDay(ZoneId zone) from class LocalDate and public ZonedDateTime atZone(ZoneId zone) from class LocalDateTime adding dependencies to ZonedDateTime? They look like "util" methods from ZonedDateTime and…
fidudidu
  • 399
  • 3
  • 10
-2
votes
2 answers

Easiest way to set past/future date in Java 8

I have a solution for setting future/past date Java 8, but I would like to know if there is a cleaner way. I have a method in which one of the argument is of type ZonedDateTime. I am extracting the time, converting to milliseconds and subtracting…
Parameswar
  • 1,951
  • 9
  • 34
  • 57
-2
votes
1 answer

How to calculate the time difference in seconds?

I have two Datetime strings: val formatter = DateTimeFormatter.ofPattern("yyyy-MMM-dd-hh-mm-ss") val startTime = formatter format ZonedDateTime.now(ZoneId.of("UTC")) //... val endTime = formatter format ZonedDateTime.now(ZoneId.of("UTC")) How can I…
Markus
  • 3,562
  • 12
  • 48
  • 85
-2
votes
1 answer

How can I sum up two ZoneOffset's?

I have two objects of ZoneOffset's parsed from Strings. How can I sum them up and apply to ZonedDateTime? For example: original ZonedDateTime is 2017-12-27T18:30:00, first offset is +03, second offset is +05 How can I get the output of…
San
  • 115
  • 3
  • 16
-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
-3
votes
2 answers

java.time.format.DateTimeParseException: Text '21:5:20' could not be parsed at index 3

I am currently getting this error and I really don't know why java.time.format.DateTimeParseException: Text '21:5:20' could not be parsed at index 3 at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1949) at…
-3
votes
1 answer

Converting Java ZonedDateTime to a different format ZonedDateTime

I have a java ZonedDateTime object in the following format 2017-01-16T21:03:10.712+09:00[Asia/Tokyo] I want it to be displayed in the following format also as a ZonedDateTime object 16/01/2017 21:03 How can I do this?
kosta
  • 4,302
  • 10
  • 50
  • 104
1 2 3
22
23