`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
Java 8 - Hashmap cannot find and return a ZonedDateTime value
I'm working on a example project where we need to store some values in a Hashmap and fetch them via REST services.
POSTing the data as
{"timestamp":"2015-09-01T16:40:00.000Z", "temperature":"27.2"}
Save method:
@PostMapping
public…

Suren Konathala
- 3,497
- 5
- 43
- 73
0
votes
1 answer
Convert from Excel datetime to ZonedDateTime
A datetime in Excel is saved as the number of days since 1900-01-01 (+1 as it thinks 1900-02-29 occurred). The fraction in the number is the time offset in the day.
This number has no concept of timezones. So 12.5 is 1900-01-12T12:00:00 in the…

David Thielen
- 28,723
- 34
- 119
- 193
0
votes
0 answers
How to convert a Date from database to a ZonedDateTime?
I have input date which is in set in ZoneDateTime format, and it is converted to Date Time format. Now I need to set the value from database which is date that has time too (Timestamp). How to set the out?
inputs:
private ZonedDateTime StrtDate; …

simmy
- 1
- 1
0
votes
3 answers
How to change +0800 to +0000 in Java?
How to change 2018-12-24 12:00:00 +0800 to 2018-12-23 16:00:00 +0000 in Java?
private String currentDateandTime = new Date();
final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
final DateFormat fullFormat = new…

Lester
- 701
- 1
- 9
- 47
0
votes
1 answer
Format ZonedDateTime
I need to format a ZonedDate time to format MM/dd/yyyy.
ZonedDateTime zonedDateTime = ZonedDateTime.now();
String date = DateTimeFormatter.ofPattern("MM/dd/yyyy").format(zonedDateTime);
ZonedDateTime zoneDate = ZonedDateTime.parse(date);
Getting…

Drew13
- 1,301
- 5
- 28
- 50
0
votes
0 answers
Select data with ZonedDateTime
I have object
...
@CreatedDate
@Column(name = "created_date", nullable = false)
@JsonIgnore
private ZonedDateTime createdDate = ZonedDateTime.now();
...
table - postgeSQL
create table inventory_request
(...
created_date timestamp,
.....
…

GoodWin
- 150
- 10
0
votes
2 answers
Java: ZonedDateTime - get the offset of a reference timestamp
I have a timestamp in UTC. I convert it into localtime. My timezone is CET/CEST.
2018-10-03 12:00 UTC => 14:00 CEST
2018-10-30 12:00 UTC => 13:00 CET
Because of my timezone the system automatically applies the correct offset: If I convert timestamp…

chris01
- 10,921
- 9
- 54
- 93
0
votes
0 answers
Java SQL Timestamp to ZonedDateTime
I want to cast a ZonedDateTime object into a java.sql.Timestamp object without using the local date.
For example, let's say I have the following datetime :
System.out.println(myZonedDateTime);
> 2018-09-02T23:55:05+04:00[Asia/Dubai]
And my local…

Nakeuh
- 1,757
- 3
- 26
- 65
0
votes
0 answers
How to deserialize and serialize zonedDateTime in java
I have an entity which has a ZonedDateTime attribute. I want that when using jackson objectMapper it deserializes it in the ISO 8601 format YYYY-MM-DDThh:mm:ss.sssZ in the UTC timezone.
But when I'm trying to do it using that pattern, I'm giving…

Gerardo
- 175
- 1
- 2
- 9
0
votes
0 answers
Is it better to convert ZonedDateTime to Long instead for better comparison performance?
In my Java code, there are a lot of places where two ZonedDateTime objects will be compared to see which is later or earlier than the other.
My question here is whether there is a better performance impact if I convert those ZonedDateTime objects to…

user1805458
- 1,081
- 3
- 9
- 21
0
votes
1 answer
ZoneDateTime object getting defaulted to UTC
Hi I have a date object in my controller request mapping. The object is of ZoneDateTime. The problem is on parsing the data to ZoneDateTime it is converting it to UTC by default. I need to retain the timezone information. Is there a way to handle…

Madie
- 231
- 3
- 10
0
votes
1 answer
Java 8 : ZonedDateTime will not support enum Month, but it will accept DataTime object which contains enum Month
I'm working on ZonedDateTime while passing arguments to the ZonedDateTime.of(1990,Month.JANUARY,20,10,20,30,400,zoneId); , it will not take Month.JANUARY as the argument, but when I'm passing the DateTime object with the enum Month.JANUARY, it will…

Arvind Katte
- 995
- 2
- 10
- 20
0
votes
1 answer
Getting JDBC & Saxon DateTime data as a ZonedDateTime object
We have a bunch of code that gets a DateTime from JDBC, Saxon (XPath), dom4j, jway json-path (JPath), & OData as a Date object. We're now up on Java 1.8 and my first question is do I want to now try to get any data that I used to get as a Date…

David Thielen
- 28,723
- 34
- 119
- 193
0
votes
1 answer
How to get a ZonedDateTime from unix time on API level 16?
I have to do some date manipulations [cringe] and I am trying to use ZonedDateTime for all its neat methods. My timestamp is in Unix time (epoch), and my API level is 16, how do I go about it?
For those using API 26+, the ZonedDateTime can be…

Caio Mar
- 2,344
- 5
- 31
- 37
0
votes
0 answers
What is the JPA entity type to be used if we use java 8 type ZonedDateTime?
I am migrating from joda to java 8 ,
initially i had this as my entity type :
import org.joda.DateTime;
@Type (type=org.jadira.usertype.dateandtime.joda.PersistentDateTime)
private DateTime dateTime
I am migrating to ZonedDateTime now,
What…

Parameswar
- 1,951
- 9
- 34
- 57