Logo

Programming-Idioms

History of Idiom 61 > diff from v29 to v30

Edit summary for version 30 by :
[JS]

Version 29

2016-02-17, 04:27:54

Version 30

2016-02-18, 16:58:00

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.

Code
var d = Date.now();
Code
var d = Date.now();
Comments bubble
See the documentation for support and polyfills for non-modern browsers.
Comments bubble
See the documentation for support and polyfills for non-modern browsers.
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
Doc URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now
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