Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to Validate Time .....

Posted on 1999-07-09
3
Medium Priority
?
180 Views
Last Modified: 2013-11-20
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).
0
Comment
Question by:rupak_khurana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1309431
Check out COleDateTime::ParseDateTime and COleDateTime::GetStatus.
0
 

Author Comment

by:rupak_khurana
ID: 1309432
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?
0
 
LVL 23

Expert Comment

by:chensu
ID: 1309433
No other built in methods.
0

Featured Post

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question