Questions tagged [offsetdatetime]

58 questions
0
votes
0 answers

OffsetDateTime does not parse correctly the time when sending a defined time

OffsetDateTime does not correctly parse the time when a defined time is sent to me I have a service with a timezone UTC +4:00 I am sent two possible cases in STRING: 1- 2022-03-30T11:22:33.44+04:00 2- 2022-03-30T11:22:33.44+0400 but when I do…
0
votes
1 answer

Custom serialization without annotations

Is there a way on Springboot that I can implement a custom serializer for a specific field on my request without doing annotations? I prefer if we could create a bean or a override a configuration and serialize a string input (from json request)…
Rye
  • 33
  • 5
0
votes
1 answer

Calculating "time ago" using OffsetDateTime in Java

I currently have this code: public static String getTimeAgo(OffsetDateTime dateArg) { Instant instantNow = Instant.now(); Instant instantThen = dateArg.toInstant(); Duration comparedDuration = Duration.between(instantThen, instantNow); …
uriri
  • 25
  • 5
0
votes
0 answers

Offset lost for OffsetDateTime with Spring Boot REST Service

I am using java OffsetDateTime to store time both on the client and server side. When I am sending the time information to the server, the local date time part looks like: "2021-06-15T15:43:50" and the offset is +02:00 (Central European Summer…
Greg
  • 1,227
  • 5
  • 23
  • 52
0
votes
2 answers

OffsetDateTime customer parser

Hello I try parse String 20110330174824917 to OffsetDateTime using DateTimeFormatter so public static void main(String[] args) { // System.out.println(OffsetDateTime.parse("20110330174824917",…
M.B
  • 134
  • 9
0
votes
1 answer

Java OffsetDateTime.parse() adds extra zeros to time

This following codes return an OffsetDateTime like this 2021-06-30T23:59:59.009966667Z, with 2 extra zeros added. I have 7 n's in the formatter, but it still returns 9 digits. Why? import java.time.OffsetDateTime; import…
0
votes
1 answer

Convert a sql timestamp to java OffsetDateTime

I need to convert some timestamps to OffsetDateTime in java. For example, I have the following time: 2020-07-31 13:15:00.000000000 -03:00 Should I use SimpleDateFormat to format this or some other helpers that are more straightforward?
Yu Wan
  • 23
  • 1
  • 4
0
votes
1 answer

What offset is used for DocusignApi Envelope.completedDateTime

I'm trying to do some DateTime calculations based off of the Envelope completedDateTime retrieved using the Docusign Java Api, but there is no offset included. How do I determine what offset is being used? the github location is:…
0
votes
2 answers

JavaScript/TypeScript how to build OffsetDateTime like in Java?

I am very new to java script, how to build offset date time in javascript, which I use to use to call and API which gets date time in string. 2020-08-27T22:54:36.922Z -> Like this in JavaScript/TypeScript The samething in Java i will do something…
0
votes
2 answers

Why is this Date string failing the validation?

I have a JSON file with a value of 2020-03-07T04:11:20.000 for a field with given pattern yyyy-MM-dd'T'HH:mm:ss.SSS. I tried to add a Z at the end of it, but it keeps failing the validation. Any idea why? I tried to do OffsetDateTime.parse(mytext,…
user998692
  • 5,172
  • 7
  • 40
  • 63
-1
votes
1 answer

SQL timestamp not converting to OffsetDateTime

I have a sql timestamp that is being returned from a query in java. I need this date as an OffsetDateTime type, but my attempts to parse it have failed. I've tried the following. What other steps do I need to take? I'm iterating through the sql…
Great Gale
  • 71
  • 1
  • 8
-1
votes
1 answer

Spring Boot Mongodb - OffsetDateTime in org.bson.Document saved as "Object" in mongodb

I want to save to mongodb an org.bson.Document containing an OffsetDateTime instance with the OffsetDateTime saved as a DATE. It is currently saved as an Object. I'm using my own custom MongoDatabaseFactory. This is my test data. I've created a…
Mercer
  • 1
  • 1
-3
votes
1 answer

Why OffsetDateTime serializations/deserialization results have difference?

I have follows object: @Validated @Getter @Setter @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode @ToString @Schema(description = "Request") public final class Request implements Serializable { private static final long…
Zhenyria
  • 376
  • 1
  • 16
1 2 3
4