Date Formating

codephantom me at noyb.com
Wed Dec 13 08:32:34 UTC 2017


On Wednesday, 13 December 2017 at 07:35:40 UTC, Jonathan M Davis 
wrote:
> In general, you probably want to cast the SysTime to a DateTime 
> if you're going to do something like that.

yes, I would agree ;-)

Of course the intention was not really to just format it the same 
way as Clock.currTime() does it, but rather to provide a way to 
more easily customise the format, however one likes, whenever one 
likes..

e.g.the following small change to the format string would make it 
return: 20171213_1924_41

(that's more like something I'd use)

   return
             format("%04s%02s%02s_%02s%02s_%02s",
                 (d.year),
                 to!(int)(d.month),
                 (d.day),
                 (d.hour),
                 (d.minute),
                 (d.second)
                 );



More information about the Digitalmars-d-learn mailing list