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

Instant vs ZoneDateTime. Converting to another timezone

I'm having a hard time understanding java.time between ZoneDateTime - Instant - LocalDateTime , so far, the only thing I know of is: Instant works in-between the two Instant (in my understanding), is a Stamp of time from the moment of time (UTC), a…
2
votes
1 answer

Check if date is older than x days (business days only)

public class App { public static void main(String[] args) { final String cobDate = "2021-04-08"; final String recordDate = "2020-12-01"; } public static ZonedDateTime getDate(String date, DateTimeFormatter formatter) { …
M06H
  • 1,675
  • 3
  • 36
  • 76
2
votes
3 answers

ISO 8601 DateTimeFormatter truncates the ms of this format:'YYYY-MM-DDTHH:mm:ss.sssZ'

An online API is requiring this format: string completion formatted as ISO 8601 timestamp - 'YYYY-MM-DDTHH:mm:ss.sssZ' 2018-11-21T22:38:15.000Z I am trying to get any LocalDate at noon to satisfy the requirement, however, when Java looks at Noon…
trilogy
  • 1,738
  • 15
  • 31
2
votes
1 answer

ZonedDateTime.parse() fails for exact the same string in Windows but works in Mac and Linux

The following UnitTest is failing when being executed through IntelliJ IDE in a Windows machine (Java 11.0.9) but passes when executed in a Mac or Linux machine with the same version of Java. @Test public void rfc1123JaveTimeUtilParsing(){ final…
2
votes
2 answers

Database DateTime milli and nano seconds are truncated by default if they are 0s, while using it in Java 11 using ZonedDateTime

I am fetching datetime from an Oracle database and parsing in Java 11 using ZonedDateTime as below: Oracle --> 1/19/2020 06:09:46.038631 PM Java ZonedDateTime output --> 2020-01-19T18:09:46.038631Z[UTC] Oracle --> 1/19/2011 4:00:00.000000 AM Java…
deval.techie
  • 53
  • 1
  • 4
2
votes
2 answers

ZonedDateTime.parse not working for parsing time with am or pm

I am learning java, trying to build a tool to convert a specific time from timezone A to timezone B based on user input (input of the time, timezone A, and timezone B). This is about the part where the tool gathers a time in a specific format to…
2
votes
1 answer

Problems with ZonedDateTime object receiving on back-end

I've faced the problem of receiving of date from front-end. I send date from front-end in the format "2020-01-03T00:00:00+02:00" to ZonedDateTime object in back-end. But instead of 2020-01-03T00:00Z[UTC], I receive 2020-01-02T22:00Z[UTC] (actualy…
Andrew
  • 39
  • 9
2
votes
1 answer

How to get the DST gap and overlap?

ZonedDateTime doesn't seem to allow to detect if the date given is in a DST gap or overlap. The docs say for the of method (creating a ZonedDateTime): In the case of an overlap, when clocks are set back, there are two valid offsets. This method…
user2923322
  • 1,072
  • 1
  • 11
  • 25
2
votes
3 answers

Javas GregorianCalendar.toZonedDateTime() returns different date for dates in the past

For some date in the past, GregorianCalendar.toZonedDateTime() returns a date that is 1 day off. For 2nd April 1893, toZonedDateTime() returns the same date, for 1st April 1893, ZonedDateTime shows me the 31st March 1893 and there is also a…
Markus
  • 165
  • 8
2
votes
2 answers

How to remove ZoneId?

Thank you always for your help. I got a problem in my project. I want to delete Zoned Id and leave only time. How to remove zoned Id? It is written using kotlin in Spring Boot Framework. data class AvailableScheduleRequest ( val address:…
조민국
  • 89
  • 1
  • 4
2
votes
1 answer

How to parse a date in flutter to a json string compatible with Java ZonedDateTime

I have a Flutter app that needs to send a post request to my Spring Boot app. The object sent must have a Date in a json string format compatible with the ZonedDateTime java class. The pattern should be: yyyy-MM-ddTHH:mm[:ss[.S]]ZZ[{ZoneId}] An…
J. Gatica
  • 153
  • 1
  • 10
2
votes
2 answers

ZonedDateTime ignores 00 for ss part

I am trying to convert string value "2018-10-11T12:00:00Z"; to ZonedDateTime. If I use the default ZonedDateTime.parse(zonedDateTime) then ss portion i.e. 00 is removed and I get "2018-10-11T12:00Z" as output. Can you please help how to retain 00 as…
sorab
  • 321
  • 1
  • 4
  • 15
2
votes
2 answers

ZonedDateTime with timezone added to print format

I'm using https://github.com/JakeWharton/ThreeTenABP in my project. I have org.threeten.bp ZonedDateTime: 2019-07-25T14:30:57+05:30[Asia/Calcutta] How can I get this printed with addition of the timezone hours? ie the result should have…
nullUser
  • 1,159
  • 2
  • 15
  • 26
2
votes
1 answer

How to add offsetTime to UTC time to get the right ZonedDateTime?

I want to convert a UTC time to a localisedDateTime or zonedDateTime. I have the following input: 2013-07-10 02:52:49,-44.490947,171.220966 Where the date time is UTC time zone. I get my zoneId with latitude and longitude which gives me…
Santa Clauze
  • 163
  • 1
  • 17
2
votes
3 answers

java.time.format.DateTimeParseException: Unable to obtain ZonedDateTime from TemporalAccessor in format ddMMyyyyhhmmss

I'm having trouble in formatting a string to a ZonedDateTime. My customer wants to have the date in a format such as ddMMyyyyhhmmss, with no separators or stuff like that. This is what I've done so far import…
Gianmarco F.
  • 780
  • 2
  • 12
  • 36