Parsing a date string into a std.datetime.datetime

Colin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 23 04:13:25 PDT 2014


Hi,

I'm looking for an easy way to parse a dates into a datetime 
object.

Most of my dates will be of the form:
mmm dd, yyyy HH:MM AM|PM

So like: "May 30, 2014 12:12 PM"

I can easily write a regex or whatever to pull these out of that 
one format, but it's not guaranteed they'll all be in the one 
format and I may have to deal with others.

Is there a helper function that I'm missing that can parse these 
dates? Maybe something similar to pythons dateutil.parser [1] ?

If not maybe adding this function to std.datetime would be a good 
project to undertake for myself...

[1] - https://labix.org/python-dateutil



More information about the Digitalmars-d-learn mailing list