How to Validate Time .....

I have a string which depicts Time e.g. "11:23". Is there a smart way using some MFC function to validate whether the string represents a valid time. The proposed way should be able to validate the string for hours(0 to 23), minutes(0 to 59) and the time separator as defined in the Control Panel. (The Time separator can be read from the Control Panel using the function GetLocaleInfo).
Who is Participating?
chensuConnect With a Mentor Commented:
Check out COleDateTime::ParseDateTime and COleDateTime::GetStatus.
rupak_khuranaAuthor Commented:
Thanks for the answer. The proposed method does check whether the string is a valid time and returns a 0 or 1. But it doesnot tell which part of it has problems. e.g, hours>23, minutes>59, time separator missing. I have  written a routine which does all that stuff but i want a built in MFC method to do the same(if available). Any other way?
No other built in methods.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.