From: noxus on
A simple question:
 
I cannot use the Time Stamp Control due to some special user interface requirements.
The user is forced to enter date and time information via some sort of a keypad. (no mouse available)
I have a year, month and day field.
 
How can I best check if the entered date is a valid date. (taking everything into account such as leap year, ...)?
 
Checking the time fields is easy.
I know how to check for a valid date in C++ so I could create a DLL but I was wondering if there is also a pure LabVIEW solution.
Thanks for the help!
From: MikeS81 on
Hi noxus, you can use the Scan from String function. If you get en error, then the date is wrong.Mike
From: altenbach on
You can form a "date time record" cluster and see if it produces a valid timestamp. It will validate the month (1..12) and year, The day will wrap, so if you enter 2-29-2008 you'll get 2-29-2008, but if you enter 2-29-2007 you'll get 3-1-2007. See if it works for your purpose.
 
<img src="http://forums.ni.com/attachments/ni/170/333039/1/ValidateDate.png">
&nbsp;Message Edited by altenbach on 06-18-2008 10:13 PM


ValidateDate.png:
http://forums.ni.com/attachments/ni/170/333039/1/ValidateDate.png


ValidateDate.vi:
http://forums.ni.com/attachments/ni/170/333039/2/ValidateDate.vi
From: noxus on
Great ... that should do the trick!
Thanks for the solution - now I don't need the extra DLL.
&nbsp;