It depends on what format your date is in.
If you have the year/month/day isolated already (as in a DateTimeType
structure), it's easy to make your own validation function -- make sure to
compare the adjusted year to the constants firstYear and lastYear.
You can examine the validation in DateTime.c. You do have the Palm OS
source code, right?
If you store your date in the 32-bit integer format (i.e. number of seconds
since 1904-01-01 00:00:00), watch out, because if the seconds value is out
of range, TimDateTimeToSeconds will set it to the constant maxSeconds.
Note that, prior to the 4.0, there was an off-by-one bug in where the
constant maxSeconds corresponded to 2031-12-31 00:00:00 instead of
2031-12-31 23:59:59. If you use the 4.0 SDK, the constant will be correct
for your compiled apps, but anything calling into pre-4.0 ROMs will of
course still see the incorrect value.
Regards,
Owen G. Emry
-----
DTS Engineer
Palm, Inc.
-----Original Message-----
From: Dan Samber [mailto:[EMAIL PROTECTED]]
Sent: Friday, 20 April, 2001 15:08
To: Palm Developer Forum
Subject: Valid dates
Is there any way to check the validity of a date?
I tried a couple of the built in functions (DateToDays) in the hope
that they might return zero if the entered date was invalid, but
(so far) no luck! DateToDays seems to always return a number....
I can of course write my own.... but it CAN get nontrivial.
Dan
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/