Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Js

Idiom #61 Get current date

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

var d = new Date();
var d = Date.now();

This returns the number of milliseconds since epoch (not an object).

See the documentation for support and polyfills for non-modern browsers.
with Ada.Calendar;
D : Ada.Calendar.Time := Ada.Calendar.Clock;

New implementation...
< >
programming-idioms.org