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

x
?
Solved

know if it is a valid time or date

Posted on 1999-07-20
3
Medium Priority
?
171 Views
Last Modified: 2010-04-04
how will i identify when the time or date inputed
is invalid or not a time or date format
ex.
  46:23:12 am ------- error (46)
  00:99:11 am ------- error (99)
  07:00:00 ob ------- error (ob)
etc...
0
Comment
Question by:mvalez
[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 12

Accepted Solution

by:
rwilson032697 earned 40 total points
ID: 1390027
I would say that StringToDateTime will throw an exception if you feed it a dud time.

Try this:

var
  TheTime : TDateTime;
...
try
  TheTime := StringToDateTime('46:23:12 am');
except
  ShowMessage('Oops - that was a bad one!');
end;

Cheers,

Raymond.

0
 

Author Comment

by:mvalez
ID: 1390028
thank you very much....
0
 

Author Comment

by:mvalez
ID: 1390029
thank you very much....
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

722 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