Logo

Programming-Idioms

History of Idiom 61 > diff from v22 to v23

Edit summary for version 23 by :

Version 22

2015-09-04, 21:15:34

Version 23

2015-10-29, 14:05:15

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
d = Time.now
Code
d = Time.now
Doc URL
http://ruby-doc.org/core-2.2.3/Time.html
Doc URL
http://ruby-doc.org/core-2.2.3/Time.html
Imports
import std.datetime;
Imports
import std.datetime;
Code
auto d = Clock.currTime;
Code
auto d = Clock.currTime;
Comments bubble
Returns a struct representing the current system time in the appropriate timezone.
Comments bubble
Returns a struct representing the current system time in the appropriate timezone.
Demo URL
http://dpaste.dzfl.pl/d474bfb0c9d8
Demo URL
http://dpaste.dzfl.pl/d474bfb0c9d8
Imports
extern crate time;
Imports
extern crate time;
Code
let d = time::now();
Code
let d = time::now();
Comments bubble
The current time in the local timezone in this format: http://doc.rust-lang.org/time/time/struct.Tm.html
Comments bubble
The current time in the local timezone in this format: http://doc.rust-lang.org/time/time/struct.Tm.html
Code
$d = time();
Code
$d = time();
Comments bubble
Function time() returns unix timestamp.
Comments bubble
Function time() returns unix timestamp.
Code
$d = time;
Code
$d = time;
Imports
import "time"
Imports
import "time"
Code
var d time.Time = time.Now()
Code
var d time.Time = time.Now()
Comments bubble
The type Time wraps a timestamp with nanosecond precision.
Comments bubble
The type Time wraps a timestamp with nanosecond precision.
Doc URL
http://golang.org/pkg/time/#Now
Doc URL
http://golang.org/pkg/time/#Now
Demo URL
https://play.golang.org/p/7BGpsxcbzf
Demo URL
https://play.golang.org/p/7BGpsxcbzf