[your code here]

Bastiaan Veelo Bastiaan at Veelo.net
Sat May 4 08:06:59 UTC 2019


On Saturday, 4 May 2019 at 03:15:59 UTC, Hello wrote:
> auto today()
> {
>     import std.datetime;
>     auto d = cast(DateTime) Clock.currTime();
>     import std.format: format;
>     return format("%04d/%02d/%02d", d.year, d.month, d.day);
> }
>
> void main()
> {
>     import std.stdio;
>     today.writeln;
> }

The cast is unnecessary, and there is writefln:

void main()
{
     import std.datetime, std.stdio;
     auto d = Clock.currTime();
     writefln("%04d/%02d/%02d", d.year, d.month, d.day);
}

https://run.dlang.io/is/wT6Cn7


More information about the Digitalmars-d mailing list