Answer the question
In order to leave comments, you need to log in
How to write current date UTC+0 Instant.now() to database?
Greetings dear forum users.
I get the current date UTC+0
Instant instant = Instant.now();
System.out.println(instant);
Answer the question
In order to leave comments, you need to log in
It is necessary to serialize the Instance object into something digestible for the database. In a string, in sql.Date ....
By default, it is serialized to BLOB - therefore it does not fit (I would also try, at least for the sake of experiment, to change the type of the field).
Instant instant = Instant().now().truncatedTo( ChronoUnit.MICROSECONDS ) ;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question