Skip to main content
Filter by
Sorted by
Tagged with
-3 votes
2 answers
181 views

DateTimeFormatter fails on valid Instants. How it is meant to format those below and above LocalDateTime.MIN and LocalDateTime.MAX? Manually? DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"...
Brethlosze's user avatar
  • 1,647
-1 votes
1 answer
183 views

I have a problem when i get a data from DB I get data like this TIMESTAMP TIME = 2024-05-15 15:12:44.0 - Timestamp SQL (package) type After i convert to Instant i have offset -3 hours Like this ...
Ilya Rogatkin's user avatar
2 votes
1 answer
600 views

I just found that the Instant#ofEpochSecond(epochSecond) has minimum/maximum values. Here comes the source codes. // Instant.java /** * The minimum supported epoch second. */ private ...
Jin Kwon's user avatar
  • 22.4k
2 votes
2 answers
6k views

I am using parmeterised method for Temporal class and passing LocalDateTime to Temporal argument and getting error in Instant.from(Temporal t) method where, t instancof LocalDateTime in my case. Here ...
gajesh's user avatar
  • 25
0 votes
1 answer
709 views

I have tests where I compare java.time.Instant dates. When I run these tests locally, everything works correctly. But remote build fails due to tests. org.opentest4j.AssertionFailedError: expected: &...
NeverSleeps's user avatar
  • 2,010
2 votes
1 answer
435 views

I am trying to send some information with Kafka. I have a class to handle this task. The class includes a private variable called "timestamp" of type Instant. When the timestamp is generated,...
User's user avatar
  • 93
4 votes
2 answers
2k views

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 ...
F0cus's user avatar
  • 645
-1 votes
2 answers
778 views

Error: Java 8 date/time type** java.time.Instant** not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310 I have followed forum comments and added relevant ...
mnfsd's user avatar
  • 1
0 votes
2 answers
2k views

I'm attempting to populate a UTC timestamp into a SQL table, but when I use Instant.now() to get the current UTC time, a conversion of Timestamp.from(instant) is writing local time zones into the ...
Randy B's user avatar
  • 31
4 votes
4 answers
2k views

In Java, If Instant represents a point in time, encoded as date and time in UTC. And LocalDateTime represents a point in time, encoded as date and time in the JVM local timezone. Why then does ...
Mike's user avatar
  • 63
0 votes
2 answers
508 views

I can get the current date using Instant.now() I am looking to get 18-<current month>-<current year>
Cork Kochi's user avatar
  • 1,921
0 votes
1 answer
445 views

Do you know why 4. and 6. prints have wrong hours in following code? LocalDateTime ldtNow = LocalDateTime.now(); LocalDateTime ldtNextMonth = ldtNow.plusMonths(1); System.out.println("1. " +...
APTower's user avatar
  • 503
-4 votes
2 answers
150 views

I have an int representing the year 2022, and I want to create an Instant object representing the first instant of the year, meaning: 2022-01-01 00:00:00. int year = 2022; Instant instant = ... How ...
Hamza LAHLOU's user avatar
0 votes
2 answers
452 views

to summarize my question, I have 2 different ZonedDateTime objects with GMT and BST but same local time. They become the same Instant values after toInstant conversion. I am expecting after conversion,...
Adrian Qin's user avatar
1 vote
2 answers
5k views

I have a simple spring boot REST API application, using plain jdbc to fetch data from a MSSQL DB. I am trying to figure out how best to retrieve a DATETIME2 column from the DB (which stores no ...
BoomShaka's user avatar
  • 1,911
1 vote
1 answer
1k views

I have following scala code: LocalDate.ofInstant(instant, zoneId) instant is java.time.Instant, zoneId is java.time.ZoneId. Intellij project is configured to jdk 17 and language level to 15. But I ...
Mandroid's user avatar
  • 7,778
0 votes
1 answer
967 views

I have to compare a instant with a date String but format are differents. The Instant is initiate with "now" but without "+nnnn" part (I think it's timezone). How can I create a ...
Broshet's user avatar
  • 289
0 votes
0 answers
332 views

This is some basic program that I trying to build to learn some Java before I'm starting in programming courses. I can't get the time to pulloff in the right time interval between Start = Instant.now()...
Amblox's user avatar
  • 1
2 votes
1 answer
156 views

I've got a problem where an Instant that occurs during the DST transition is being persisted correctly to the database, but when read back is returning a different value. Specifically, I am in Europe/...
JackPGreen's user avatar
  • 1,139
0 votes
1 answer
909 views

Till now i was using val date = Instant.now(Clock.system(ZoneId.of("UTC"))) to generate the instant timestamp. Now I need to substitute it with the date that I want to specify for example &...
Saba's user avatar
  • 484
3 votes
2 answers
2k views

I am trying to parse the following string 2021-10-15T08:39:05+02:00 into an Instant this works seamlessly using Java 15 but throws an error for Java 11. java.time.format.DateTimeParseException: Text '...
joachim's user avatar
  • 692
2 votes
3 answers
3k views

How do I convert the datetime that is passed as string 2018-08-10T18:25:00.000+0000 to a Instant? I tried the below and it did not work. public static Instant toInstant(final String timeStr) { if ...
serah's user avatar
  • 2,177
10 votes
1 answer
2k views

A new interface java.time.InstantSource was added in Java 17. What is the use case of that additional abstraction if all implementations of that interface are Clock implementations too anyway?
Олег Мельник's user avatar
2 votes
2 answers
702 views

I have to convert a date for the purpose of comparison using junit. I get a date from DB which is "06/25/2021 10:26:33.0" and I have to convert it to "2021-06-25T10:26:33.000-04:00"...
Monnie_tester's user avatar
1 vote
0 answers
55 views

When running the following code in Java 8, the Instant produced from parsing the String "2021-03-26T23:43:03+01:00[Europe/London]" is "2021-03-26T23:43:03Z" (which afaik is right ...
MTdP's user avatar
  • 11