Formatted date

Anonymouse zorael at gmail.com
Wed Mar 22 14:19:42 UTC 2023


On Wednesday, 22 March 2023 at 14:02:53 UTC, Alexander Zhirov 
wrote:
> So that i can get a more readable look:
>
> `2023-Mar-22 16:53:42.2507395` => `2023.03.22 16:53:42`

Maybe there's a better way but I just do this.

```
import std;

void main()
{
     const now = Clock.currTime();
     enum pattern = "%d.%02d.%02d %02d:%02d:%02d";
     writefln(pattern, now.year, now.month, now.day, now.hour, 
now.minute, now.second);
}
```

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


More information about the Digitalmars-d-learn mailing list