Category Archives: Programming

Articles about programming and programming languages.

My kingdom for a C++ date parsing library that can tell me if the user supplied the time

I don’t know if I need to do something so bizarre that nobody thought of it before or everyone just shrugged and worked around it. Basically, I want to take user date input on a form, parse it, and know if they supplied the time portion, date portion, or both. Lots of libraries will parse it without both parts being present, but then they default them. For example, the COleDateTime object in Windows will handle a string that contains date, time, or datetime, but you can’t really tell what was supplied. I mean, you can accept that people are unlikely to have entered Dec. 31, 1899 for a date and so can make some assumptions, but time is not supplied, it defaults to 00:00:00 (midnight) and there is no way to tell if it is because that was what was entered or if it was just not supplied.

I suppose I could write my own, but that’s a major undertaking since it needs to support internationalization, many languages, etc. That’s a big piece of code. Much bigger than I have time to do. So… My kingdom (which is, admittedly, pretty tiny) for a library that can do what I need.