Date formatting in D

aberba via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 8 07:29:11 PST 2017


On Tuesday, 7 March 2017 at 20:52:39 UTC, ikod wrote:
> On Tuesday, 7 March 2017 at 20:29:07 UTC, aberba wrote:
>> I've been trying to figure out an inbuilt functionality in 
>> phobos for formatting date. In my use case, I've been trying 
>> to format current Unix timestamp to something like "Thu, 08 
>> Mar 2017 12:00:00 GMT".
>>
>> How do I go by this easily (Currently, long concatenation of 
>> strings is what I'm thinking)?
>>
>> I saw this thread[1] from 2011 on similar issue. Has it been 
>> resolved? What is the state of toCustomString?
>>
>> [1] 
>> http://forum.dlang.org/post/mailman.673.1320367887.24802.digitalmars-d-learn@puremagic.com
>
> Straightforward solution:
>
> https://dlang.org/library/core/stdc/time/strftime.html
> http://man7.org/linux/man-pages/man3/strftime.3.html
>
> Maybe there is something better.

Having to do these stuff with C is a punch in the face.

Or PHP was:

date(format, timestamp);

Almost every other language (ive used) has this equivalent.


More information about the Digitalmars-d-learn mailing list