The Instant.now();
gives 2022-12-14T22:55:56.055612600Z
. But I would like to have output like this 2022-12-14T00:00:00.000Z
. Meaning, I need instant to provide me with current date, but the time with all zeros. How can I achieve?
Asked
Active
Viewed 28 times
0

mmar
- 1,840
- 6
- 28
- 41
-
3the [documentation](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/time/Instant.html) shows all methods of the `Instant` class - e.g. `truncatedTo()` (with `ChronoUnit.DAYS)`) – user16320675 Dec 14 '22 at 23:00
-
3It's worth being *very* aware that "current date" is only with respect to UTC in this case. That may be what you want, but you should check. – Jon Skeet Dec 14 '22 at 23:10