Questions tagged [offsetdatetime]
58 questions
                    
                    32
                    
            votes
                
                6 answers
            
        How to convert LocalDateTime to OffsetDateTime?
How to convert LocalDateTime to OffsetDateTime?
private OffsetDateTime getEntryDate(Payment payment) {
    return Optional.ofNullable(payment)
                   .map(Payment::getEntryDate)
                   .map(SHOULD RETURN OffsetDateTime)
     …
         
    
    
        Melad Basilius
        
- 3,847
- 10
- 44
- 81
                    7
                    
            votes
                
                5 answers
            
        Why can't OffsetDateTime parse '2016-08-24T18:38:05.507+0000' in Java 8
The expression
OffsetDateTime.parse("2016-08-24T18:38:05.507+0000")
results in the following error:
java.time.format.DateTimeParseException: Text '2016-08-24T18:38:05.507+0000' could not be parsed at index 23
On the other…
         
    
    
        Ryan Russell
        
- 500
- 4
- 9
                    6
                    
            votes
                
                4 answers
            
        Are time zone designators- "T" and "Z" case sensitive in ISO8601 format?
I am using following ISO8601 format:
YYYY-MM-DDThh:mm:ssZ
And I used OffsetDateTime.parse() to parse this format. I was able to parse date-time by passing t (instead of T) and z (instead of Z) here.
So can anyone tell if it is allowed in ISO8601 or…
         
    
    
        Aishwer Sharma
        
- 205
- 2
- 17
                    5
                    
            votes
                
                3 answers
            
        How to get the date and time in format 2022-10-03T19:45:47.844Z in Java
I need the current system date and time in 2022-10-03T19:45:47.844Z format in a java class.
I tried using the zoneddatetime and simple date format but couldn't get the write syntax or code from online. I'm beginner in Java, any help is…
         
    
    
        Pranoy Kakubal
        
- 61
- 1
- 4
                    4
                    
            votes
                
                2 answers
            
        Convert timestamp with offset to UTC
Conversion
I have a timestamp with an offset (-6) in the following format:
2019-11-30T00:01:00.000-06:00
and I want to convert it to an UTC timestamp, like:
2019-11-30T06:01:00.000Z
Attempt
I tried it the following way:
String text =…
         
    
    
        F0cus
        
- 585
- 3
- 18
- 52
                    3
                    
            votes
                
                1 answer
            
        How to directly retrieve a UTC OffsetDateTime using MySQL Connector/J?
I prefer all times to be in UTC, except for when they are displayed.  At the last moment, they can be converted to a local time for display only.
I've always stored UNIX timestamps (seconds since epoch) in MySQL before, in an integer field. I'm…
         
    
    
        user1902689
        
- 1,655
- 2
- 22
- 33
                    3
                    
            votes
                
                2 answers
            
        Java OffsetDateTime returning wrong offset
I have a Java Timestamp value like: 1799-12-31 19:03:58.0
And when I try to convert it into the OffsetDateTime using the code:
timestamp.toLocalDateTime().atZone(ZoneId.systemDefault()).toOffsetDateTime();
It gives me the output…
         
    
    
        Arthur
        
- 87
- 6
                    3
                    
            votes
                
                1 answer
            
        OffsetDateTime formatting and parsing
This code
String formattedDate = OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE);
OffsetDateTime.parse(formattedDate, DateTimeFormatter.ISO_OFFSET_DATE);
leads to
java.time.format.DateTimeParseException: Text '2020-11-27+01:00'…
         
    
    
        Buka
        
- 226
- 3
- 12
                    2
                    
            votes
                
                1 answer
            
        java.lang.UnsupportedOperationException: Cannot have circular references in bean class but got the circular reference of class java.time.ZoneOffset
While executing the below command
StructType obs = Encoders.bean(Test.class).schema();
I am getting the below error
java.lang.UnsupportedOperationException: Cannot have circular references in bean class, but got the circular reference of class class…
         
    
    
        Vidhi Agarwal
        
- 23
- 3
                    2
                    
            votes
                
                2 answers
            
        OffsetDateTime value is changed when retrieved from the database
I am using a table from MS SQL database and developed a GET API using Spring Boot, to retrieve all the data from that table.
Here the table contains a column of type datetimeoffset(7).
I have data member OffsetDateTime updatedDate inside my Entity,…
         
    
    
        Vishal
        
- 674
- 1
- 7
- 20
                    2
                    
            votes
                
                1 answer
            
        How to make Spring Kafka JsonDeserializer retain the timezone offset when deserializing to OffsetDateTime
I have a message being received through Kafka, which I know has a non-UTC timezone in it.
When I use the org.apache.kafka.common.serialization.StringDeserializer to verify this I get the right timestamp in ISO 8601 format with the timezone:
{  "id":…
         
    
    
        jbx
        
- 21,365
- 18
- 90
- 144
                    2
                    
            votes
                
                2 answers
            
        Kotlin DateTimeParseException
Getting date from https://api.spacexdata.com/v3/launches
This date have format: 2006-03-25T10:30:00+12:00.
I want convert it to "dd, mm, yyyy", but always getting error:
"java.time.format.DateTimeParseException: Text '2006-03-25T10:30:00+12:00'…
         
    
    
        bboy
        
- 55
- 5
                    2
                    
            votes
                
                2 answers
            
        Java and Oracle timestamp with time zone
I'm trying to save two dates in Oracle with hibernate. both dates have the same timestamps in the moscow time zone: 2005-10-30T02:00+03:00[Europe/Moscow] and 2005-10-30T02:00+04:00[Europe/Moscow] ("Sun Oct 30 02:00:00 MSK 2005" and "Sun Oct 30…
         
    
    
        AVANG
        
- 71
- 2
- 9
                    1
                    
            vote
                
                1 answer
            
        Java OffsetDateTime cannot be parsed
I want to parse the following String into an OffsetDateTime:
OffsetDateTime test = OffsetDateTime.parse("2021-12-31T23:00:00.000+00:00");
However, this results in an exception:
java.time.format.DateTimeParseException: Text…
         
    
    
        Lars Wigger
        
- 23
- 6
                    1
                    
            vote
                
                1 answer
            
        How to use java `OffsetDateTime` in apache tinkerpop gremlin?
The application can be accessed from a different timezone, so I am trying to store date time using class java.time.OffsetDateTime.
startTime: "1996-12-19T16:39:57-08:00",
endTime: "1996-12-19T16:39:57-08:00"
The application/API receives the time in…
         
    
    
        Thirumal
        
- 8,280
- 11
- 53
- 103