Link to home
Start Free TrialLog in
Avatar of rupak_khurana
rupak_khurana

asked on

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).
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rupak_khurana
rupak_khurana

ASKER

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.