Parse Time using std.date

Jesse Phillips jessekphillips+D at gmail.com
Wed Jan 12 10:25:54 PST 2011


Mandeep Singh Brar Wrote:

> Hi,
> 
> Is there a way to parse a Time string like 15:45 to a Date structure.
> Parse method in std.date returns it as invalid. As a hack it works by
> prepending it with something like 1-1-1970. But is there a cleaner
> way to it.
> 
> Thanks
> Mandeep

No. Though std.date will be replaced with std.datetime (soon?), which might have what is needed.

I was doing something where I would grab dates from many formats, and the strategy I used, attempt a conversion, if that failed append current year. (though I wasn't concerned with time as you are) (I wanted to find out if the date had already past so assuming the most current information was the best option.)



More information about the Digitalmars-d-learn mailing list