Questions tagged [offsetdatetime]

58 questions
1
vote
2 answers

OffsetDateTime object's LocalDateTime and ZoneOffset values differ when using differing instantiation methods

Creating OffsetDateTime objects using ofInstant(instant, zoneid) or via fluent interface can lead to non-equal objects (by using compareTo assertions or comparing the ZoneOffset and LocalDateTime fields) if the instantiation via the fluent…
rotzbouw
  • 11
  • 1
1
vote
1 answer

Thymeleaf Expression [#temporals.format( ${event.eventStart} , 'pattern')] @20: EL1043E: Unexpected token. Expected 'rparen())' but was 'lcurly({)'

event.eventStart is an OffsetDateTime object. Added to POM org.thymeleaf.extras thymeleaf-extras-java8time
0
votes
1 answer

date not format as in hibernate 5 with jsonb in hibernate 6

I am migrating to quarkus 3 and i couldnt find a way to serialize properly (like in hibernate 5) my OffsetDateTime for a field annotated with jsonb in an entity : This is one of my entity, OffsetDateTime is not a problem here when persisting because…
AJO
  • 31
  • 5
0
votes
0 answers

Convert String value to OffsetDateTime

I have the following code: public class Objc{ OffsetDateTime purchaseDate = new OffsetDateTime(); // getter/setter } .... String buyDate = ......; objc.setPurchaseDate (new OffsetDateTime(buyDate)); How to…
Peter Penzov
  • 1,126
  • 134
  • 430
  • 808
0
votes
0 answers

Unusual Behavior of OffsetDateTime.now() on Different Machines

I've encountered a peculiar issue while using OffsetDateTime.now() in my Java code. On my machine, repeated calls to OffsetDateTime.now() return different values each time, which is what I expect. However, on my colleague's Windows machine, multiple…
Reda Red
  • 3
  • 3
0
votes
2 answers

Java Current OffsetDateTime object in UTC with three digit fractional seconds (YYYY-MM-dd'T'HH:mm:ss.SSS'Z')

OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneId.of("UTC")); Above snippet gives me six-digits fractional seconds, but I need a utility method that returns current OffsetDateTime object (not String) in UTC with three-digits format (for…
Naim
  • 5
  • 2
0
votes
0 answers

Android Room OffsetDateTime how to safe the Zone Anomalies

one question. I want to store some time data in room Database. In my application the user can press a Start and Stop Button to save a Start- and a EndTime for doing different tasks. Later he can review all times with a RecyclerView... Now, the…
steeveKA1
  • 13
  • 6
0
votes
1 answer

Deserialize from JSON date "dd.MM.yyyy HH:mm:ss" to OffsetDateTime using ObjectMapper

In tests i m trying to mock response from DB. Json: { description: "testDescription" contactPhone: "123456789" createDate: "18.04.2023 10:33:23" } My POJO has field (OffsetDateTime createDate). Here is my…
Nik Korn
  • 21
  • 5
0
votes
1 answer

Deserialize OffsetDataTime java 17

I test endpoints' basic security. Test mvc.perform(MockMvcRequestBuilders.post(path) .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsString(OBJECT)) .params(usersSampleRequestParams) …
John Smith
  • 77
  • 7
0
votes
0 answers

What datetime java class is the best for checking SAML condition (The NotBefore and NotOnOrAfter attributes)?

I want to check if the SAML response is within the validity period. I am using OffsetDateTime class to convert current time in UTC so I can compare SAML response times with the current time. NotBefore [Optional] Specifies the earliest time instant…
ilce
  • 1,007
  • 3
  • 12
  • 20
0
votes
0 answers

OffsetDateTime nano truncate after save do DB

Me and my colleagues noticed weird behaviour on our local environments (Manjaro & Windows) thanks to integration tests. Field of the type OffsetDateTime differs in nano before and after real save to the DB. I was trying to find some information and…
0
votes
0 answers

Offset not calculated correctly at OffsetDateTime to Instant conversion in Java 8

I would need the community's help because I could not find the answer in the Java documentation. I don't understand how the offset is taken into the math calculations when I try to convert an OffsetDateTime (ex: 2022-07-09T11:30:34) object to an…
0
votes
0 answers

How can we compare ActionTimestamp and Posteventtimestamp in Java and how to update actiontimestamp to currentTimestamp

How can I compare this timestamp format "20220708T0000Z" with current time and how can we update this timestamp to current time in same format in java, I have tried DateTimeFormatter and OffsetDateTime but both are not worked for me. Please help…
0
votes
1 answer

Save OffsetDateTime to Room database

I have a data class with a field of type OffsetDateTime. With the room database, I have the following error: Cannot figure out how to read this field from a cursor. private final java.time.OffsetDateTime How can I fix this? Thanks
T D Nguyen
  • 7,054
  • 4
  • 51
  • 71
0
votes
0 answers

Issue with OffsetDateTime deserialization from json request body Spring-Boot REST API

I'm having a OffsetDateTime field in my POJO: @NotBlank(message = "startTime cannot be null or empty; ") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") @JsonSerialize(using =…