Logo

Programming-Idioms

History of Idiom 61 > diff from v25 to v26

Edit summary for version 26 by :
[Java] Comment emphasize

Version 25

2016-01-01, 00:35:44

Version 26

2016-01-01, 01:37:11

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Idiom #61 Get current date

Assign to variable d the current date/time value, in the most standard type.

Imports
import java.time.Instant;
Imports
import java.time.Instant;
Code
Instant d = Instant.now();
Code
Instant d = Instant.now();
Comments bubble
New in Java 8. Use Date on java 7.
Comments bubble
New in Java 8.
Use Date on java 7.
Doc URL
https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html
Doc URL
https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html