On Saturday, 29 March 2014 at 05:01:14 UTC, Gary Miller wrote:
-- SNIP --

I only need it down to the second and from my current machine so I don't need to use any of the more accurate clocks used for benchmarking right now.

On Saturday, 29 March 2014 at 09:30:44 UTC, Gary Willoughby wrote:
This is the easiest way i know.

import std.stdio;
import std.datetime;

void main(string[] args)
{
        writeln(Clock.currTime.toLocalTime.toSimpleString);
}

toSimpleString (and toString) returns a string with fractional
seconds; which I suspect is not what Gary Miller wants.


It would be nice if all the primitive datatypes had a consistent toString cast or function but since I'm not seeing those I guess writeFormatted must be the preferred way of getting values into string format.

See std.conv and the 'to' function.

data.to!(string)
data.to!(int)
etc...

http://dlang.org/phobos/std_conv.html#.to

Considering the international spread of D users I find it
surprising that the date & time formatting functions in phobos
are not localizable.

When working in Windows I prefer to wrap GetDateFormatEx, but it
would be nice to have an OS agnostic version.

Reply via email to