`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.”
Questions tagged [zoneddatetime]
339 questions
0
votes
2 answers
How can I parse string using square brackets as a delimiter in Java?
I have a class that parses ZonedDateTime objects using.split() to get rid of all the extra information I don't want.
My Question: Is there a way to use square brackets as delimiters that I am missing, OR how do I get the time zone ([US/Mountain]) by…

StarSweeper
- 397
- 2
- 4
- 28
0
votes
1 answer
ZonedDateTime in MongoDB through Morphia
In a nutshell:
java.time.ZonedDateTime has no args constructor (actually it has no
constructor at all)
to get over this, I should write a ZonedDateTimeConverter for Morphia
if I try to save and load my ZonedDateTime without converter, Morphia
saves…

maestro
- 671
- 1
- 13
- 27
-1
votes
2 answers
How to convert ZonedDateTime to LocalDateTime?
I want to convert local date and time to UTC and then back to local date and time, I could not find solutions on internet. I used below code:
// get local date and time
LocalDateTime localDateTime = LocalDateTime.now();
// print local date…

Vinod
- 55
- 3
-1
votes
3 answers
How to convert Timestamp in CDT Format to MM/DD in Java?
I have a timestamp in cdt format as below "2023-06-05T09:00:01CDT", I want to convert this timestamp into MM/DD format in Java.
I have tried below :
The expected output was: 6/5
But was getting parsing error.
ZonedDateTime ztime =…

BugEater
- 21
- 3
-1
votes
2 answers
Set empty value for ZonedDateTime
I want to migrate this code from Joda-Time to its replacement, java.time (JSR 310).
Specifically I want to use ZonedDateTime.
Old code:
DateTime startTime = new DateTime();
DateTime stopTime = new DateTime();
durationMilli = Math.max(1,…

Peter Penzov
- 1,126
- 134
- 430
- 808
-1
votes
1 answer
String timestamp to Date in java
I want to convert a String timestamp "20221225182600Z+0100" to date in java without using simpledateformat
I am getting an error
Text '20221225182600Z+0100' could not be parsed at index 2
String dateString =…

VIMALJITH K
- 1
- 2
-1
votes
2 answers
Convert a specific time in one timezone to another timezone
I'm trying to convert the hour 8:00am EST (America/New_York), to display in whatever time that would be on the users system default zone. The date is not needed, only the time. I have been searching and I can only find ways to convert the current…

aweig
- 9
- 2
-1
votes
2 answers
Format ZonedDateTime and return ZonedDateTime
I have below ZonedDateTime object:
ZonedDateTime z1 = ZonedDateTime.parse("2021-08-06T19:01:32.632+05:30[Asia/Calcutta]");
Need to return another ZonedDateTime object with value: 06-Aug-2021 19:01:32 IST
I can format it like…

nanosoft
- 2,913
- 4
- 41
- 61
-1
votes
1 answer
Create an Instance of ZonedDateTime from String with same time as String [Java]
I want to create an instance of ZonedDateTime from String. I want to make "2021-03-18 8:00:00" turn into "2021-03-18 8:00:00 EST". I don't want an unexpected variable to interfere by converting 8:00:00 to a different time from what is shown. i.e…

Coal Miner 555
- 3
- 1
-1
votes
2 answers
How to perform delete on a CURRENT_TIMESTAMP column?
ISSUE:
I have table [ INFOTABLE ] with a timestamp column named DATETIMESTAMP [INTEGER] datatype.
I need to delete records using this column but delete query throws error.
It is mainly because of the T [TIME indicator] inbetween the timestamp…

Gladiator
- 169
- 1
- 2
- 12
-1
votes
3 answers
java GMT datetimeparse
I have a string like the following
Fri May 31 2019 05:08:40 GMT-0700 (PDT)
I want to convert this to something like yyyy-MM-dd.
I tried this.
String date1 = "Fri May 31 2019 05:08:40 GMT-0700 (PDT)";
DateTimeFormatter f =…

AnanR
- 29
- 1
- 7
-2
votes
0 answers
How would I convert some string dates to ZonedDateTime
I'm trying to perform a simple conversion from a set of date strings to ZonedDateFormat:
String dateString = "2034-09-03T00:00:00Z";
String date2String = "2023-01-20T13:45:24.548Z";
Parsing with the ZonedDateFormat works with the decimals but…

lil chogomo
- 41
- 1
- 1
- 6
-2
votes
1 answer
How to parse date string '2021-08-03T10:00:00EDT' to ZonedDateTime in java?
I am getting below error when trying with pattern with below pattern
private static final DateTimeFormatter DATE_TIME_FORMATTER
= DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssz");
Can someone explain reason behind this??
Error received…
-2
votes
2 answers
ZonedDateTime to java.util.Date -> EST to UTC - Off by 1 hour
I'm trying to convert ZonedDateTime (EST) to Date (UTC) i see 1 hour off for the month of march for 13 and 14th calendar date
SystemDefault - UTC
ZonedDateTime zonedDateTime1 = ZonedDateTime.of(2021, 3, 13, 19, 0, 0, 0,…

srikanthinu
- 9
- 1
-2
votes
2 answers
Problem with convert String to LocalDateTime
When I run this I get exception:
Exception in thread "main" java.time.format.DateTimeParseException: Text '2020-12-15 13:48:52' could not be parsed: Invalid value for ClockHourOfAmPm (valid values
I write to console: 2020-12-15 13:48:52
public…

Hubert Kowalski
- 55
- 1
- 5