Getting the current datetime converted into a string for writing to stdout

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 30 23:15:43 PDT 2014


On Sunday, March 30, 2014 08:25:42 Andre Artus wrote:
> Considering the international spread of D users I find it
> surprising that the date & time formatting functions in phobos
> are not localizable.

If could go back, there wouldn't even be anything to localize. toSimpleString 
is there because it was in Boost (and it's what toString uses), but by having 
_three_ different string functions for each type instead of just ISO and ISO 
Extended. So, that's arguably bad - certainly it overcomplicates things IMHO. 
And toSimpleString uses English names for the months which is _definitely_ 
bad, because it opens up the question of localization, which I see no reason 
to deal with in this context, especially because it opens up a huge can of 
worms. By sticking to ISO and ISO Extended, we'd be completely standards 
compliant and would avoid the whole localization issue entirely. As it stands, 
we just acknowledge that it's stupid that toSimpleString is there (thereby 
introducing the question of localization) and have agreed that localization is 
outside the scope of std.datetime.

Unfortunately, removing toSimpleString would obviously break code, and 
changing toString to do the same as toISOExtString (as it probably should) 
could also break code if there's code in the wild which relies on the exact 
format of toString. So, we're kind of stuck.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list