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
5
votes
2 answers

Kotlin/java - How to convert a date time string to Instant?

I am trying to create an instance of Instant from date and time strings. Date is formatted like this yyyy-MM-dd. So the values could look like this: val date = "2021-11-25" val time = "15:20" I am trying to make a valid instant from this 2 strings…
Leff
  • 1,968
  • 24
  • 97
  • 201
5
votes
2 answers

Java - ZonedDateTime does not correctly convert to Date object?

I have the following Java code: Date convertedDate = Date.from(zonedDateTime.toInstant()); The Issue I am having is that convertedDateis not correct in comparison to the zonedDateTime object. For Example when I have a zonedDateTime object…
java12399900
  • 1,485
  • 7
  • 26
  • 56
5
votes
1 answer

Get last day of the month from a ZonedDateTime object

I have previously been able to do this with Joda DateTime objects but i'm unsure how i can get the last day of a given month for a ZonedDateTime instance with a timezone applied. e.g A leap year February return 29 April returns 30. December returns…
MisterIbbs
  • 247
  • 1
  • 7
  • 20
5
votes
3 answers

Why does jackson convert ZonedDateTime to decimal?

I am trying to understand why does Jackson transform ZonedDateTime to Decimal while getting MvcResult in a spring intergration Test ? Here is the expected date : 2019-10-01T10:10:44+02:00[Europe/Paris] and the actual result : 1572426644.000000000
the_tourist
  • 191
  • 2
  • 13
5
votes
1 answer

Flink Serialization of ZonedDateTime

I have to work with time zones and nano second time resolution. I therefore use ZonedDateTime. Apparently Apache Flink does not serialize ZonedDateTime properly. It does serialize the LocalDateTime part as expected, however, it forgets to handle the…
Daniel
  • 1,522
  • 1
  • 12
  • 25
5
votes
1 answer

Mule - NoClassDefFoundError: Could not initialize class java.time.zone.ZoneRulesProvider

I've been trying to solve this problem without luck, hopefully someone could help me out... I created a DateUtil.java class which is placed within my project at: src/main/java/util/DateUtil.java I call "convertTime" method with the invoke component…
Adalberto
  • 75
  • 1
  • 5
5
votes
2 answers

Can't convert string to ZonedDateTime: DateTimeParseException

I try to convert string from JSON to ZonedDateTime just like static String getWatchTime(JSONObject aJson, JSONObject bJson) { long difference = 0 ; try { String aTime = aJson.getString("time_utc_8"); String bTime =…
Zi-yan Tseng
  • 184
  • 1
  • 1
  • 14
4
votes
1 answer

ZonedDateTime correctly parses "GMT" zone from pattern 'O' but not "UTC"

The following correctly parses the text input "2022-12-29 01:16:03 GMT+08:00". public ZonedDateTime parseZonedDateTime(String timeStr) { DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss O"); ZonedDateTime zonedDateTime =…
4
votes
2 answers

ZonedDateTime not displaying Time Zone expected via DateTimeFormatter

I have a date input with a timezone of EST. I'm parsing it to a ZonedDateTime, but when formatting, it's being displayed as GMT-04:00, rather than EST as I'd expect. Why is this happening - can I get it to display the timezone I…
Jakg
  • 922
  • 12
  • 39
4
votes
1 answer

swagger-codegen-maven-plugin ignores the importmapping i have set for ZonedDateTime when generating an API class

I am trying to generate an API class from a yaml file using ZonedDateTime as the class for a date. When i do this i can successfully change the generated class OffsetDateTime to ZonedDateTime in the configuration, but the correct import statement is…
4
votes
3 answers

Java, parse string 'yyyy-MM-dd'T'HH:mm:ss' to ZonedDateTime without changing time

I have a string "2018-07-24T01:30:27". I want to parse this into ZonedDateTime with EST timezone without changing the time. I have the code... String foo = "2018-07-24T01:30:27"; ZoneId zone = ZoneId.of("America/New_York"); SimpleDateFormat…
4
votes
1 answer

Neo4j OGM Unable to process ZonedDateTime field on class my.class.Class. Check the mapping

I am trying to persist a @NodeEntity which has a field of type java.time.ZonedDateTime into my Neo4j database using the Bolt driver, but all I get is this warning message: org.neo4j.ogm.context.EntityGraphMapper : Unable to process AT on class…
4
votes
2 answers

Does a 'z' in a datetime String have different outputs in different locales?

Not long ago, I provided an answer to a question about how to extract the time zone from a ZonedDateTime parsed from a String. It worked in general, but there were different outputs of the same code on OP's system an my one, which somehow doesn't…
deHaar
  • 17,687
  • 10
  • 38
  • 51
4
votes
1 answer

ZonedDateTime change behavior jdk 8/11

I am migrating an application from jdk 8 to 11 and I can see ZonedDateTime change is behavior about daylight saving time. JDK8 ZonedDateTime parse = ZonedDateTime.parse("2037-05-10T19:15:00.000+01:00[Europe/Paris]"); …
user2864342
  • 43
  • 1
  • 6
4
votes
2 answers

Spring boot 2 : ConverterNotFoundException: No converter found capable of converting from type [java.time.ZonedDateTime] to type [java.util.Date]

I use spring-boot 2. I my Junit test (@SpringBootTest), i use a org.springframework.test.web.servlet.MockMvc @Test @WithMockUser(roles = {"ADMIN"}) public void testGetSearchByFoodIdWithAdmin() throws Exception { final ResultActions resultActions…
Stéphane GRILLON
  • 11,140
  • 10
  • 85
  • 154