DateTime formatting

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Dec 20 18:50:37 UTC 2017


On Wednesday, December 20, 2017 14:30:55 bauss via Digitalmars-d-learn 
wrote:
> I can't seem to find anything in Phobos that allows you to
> specify custom formats for dates.
>
> Am I on my own or is there already such functionality?
>
> I'm interested in a formatter with the possibility to output ex.:
>
> December 20th, 2017 10:00 AM
>
> All I could find was toSimpleString(), but it seem to use a
> pre-defined format like:
> YYYY-Mon-DD HH:MM:SS

At present, the only formats that Phobos supports are ISO, ISO Extended, and
Boost's simple time format. It does not yet have support for custom
date/time formatting beyond constructing the string yourself from the
properties on a DateTime or SysTime.

This was posted about recently in the Announce group though:

http://code.dlang.org/packages/datefmt

It might do what you want.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list