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

Idiom #61 Get current date

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

#include <time.h>
time_t d=time(0);
DateTime d = DateTime.Now;
import std.datetime;
auto d = Clock.currTime;
var d = new;
d = :calendar.local_time
D = calendar:local_time().
import "time"
var d time.Time = time.Now()
d <- System.Posix.Time.epochTime
var d = new Date();
var d =;
import java.time.Instant;
Instant d =;
date =
time = os.time()
$d = time();
  _d: TDateTime;
  _d := Now;
$d = time;
import datetime
d =
d =
extern crate time;
let d = time::now();
use std::time::SystemTime;
let d = SystemTime::now();

Do you know the best way to do this in your language ?
New implementation...

Idiom created by

Related idioms