From: hamlet on
I have found a piece of coding to validate a date entered by users. I get he
date selected from pull down lists as separate field items for day, month &
year so that we have a consistent controlled input.

The coding takes the values and compares the date so:
DOBnumber := DateToNum(DOBday, DOBmonth, DOByear)
DOBdate := Date(DOBnumber)
BadDate := (DOBday <> Day(DOBnumber) | DOBmonth <> Month(DOBnumber) | DOByear
<> Year(DOBnumber))

This coding works fine as long as the DOB it is on or after 01/01/1970 which
apparently is as far as Authorware running under MS Windows goes - not really
useful for a DOB in a working environment, as some working people are over 37.

Does anyone know of a way to get round this, without pages of code to compare
all possibilities.

Thanks in advance.

From: Erik L. **Community Expert** on
Ultimately, what do you need to do? What 'validation' needs to be
performed? What 'all possibilities' are you trying to compare?
Is this all to ensure the date exists? Like someone can't select
February 31st?
If that's the case, perhaps a workaround is to populate your day
pull-down with only the number of days applicable to the selected month.

I've never noticed the 1970 limit on these functions before. That sure
does seem odd and somewhat unhelpful.
Erik

hamlet wrote:
> I have found a piece of coding to validate a date entered by users. I get he
> date selected from pull down lists as separate field items for day, month &
> year so that we have a consistent controlled input.
>
> The coding takes the values and compares the date so:
> DOBnumber := DateToNum(DOBday, DOBmonth, DOByear)
> DOBdate := Date(DOBnumber)
> BadDate := (DOBday <> Day(DOBnumber) | DOBmonth <> Month(DOBnumber) | DOByear
> <> Year(DOBnumber))
>
> This coding works fine as long as the DOB it is on or after 01/01/1970 which
> apparently is as far as Authorware running under MS Windows goes - not really
> useful for a DOB in a working environment, as some working people are over 37.
>
> Does anyone know of a way to get round this, without pages of code to compare
> all possibilities.
From: Amy Blankenship on

"Erik L. **Community Expert**" <erik(a)pasdespam.capemedia.net> wrote in
message news:g0k39c$1ik$1(a)forums.macromedia.com...
> Ultimately, what do you need to do? What 'validation' needs to be
> performed? What 'all possibilities' are you trying to compare?
> Is this all to ensure the date exists? Like someone can't select February
> 31st?
> If that's the case, perhaps a workaround is to populate your day pull-down
> with only the number of days applicable to the selected month.
>
> I've never noticed the 1970 limit on these functions before. That sure
> does seem odd and somewhat unhelpful.

That's the date of the "Epoch" and it's pretty standard in most programming
languages. I'm confident they picked that year because that's when I was
born, and hence no important events could have happened prior to that date
;-). I believe there may be some code on the aware list
http://listserv.cc.kuleuven.ac.be/cgi-bin/wa?A0=aware&D=1&O=D that describes
how to get around this if you search the archives. I think that in essence
you add some number of years to the date to find another year after 1970
with the same days of the week/leap year status.

HTH;

Amy


From: Chris Forecast on
I give a couple of different soultions at the end of this thread:

http://listserv.cc.kuleuven.ac.be/cgi-bin/wa?A2=ind0608B&L=aware&D=0&P=2874

Chris Forecast


From: Erik L. **Community Expert** on
That's the year I was brought into this world as well, so I must agree
with your conclusion!
Erik

Amy Blankenship wrote:

> I'm confident they picked that year because that's when I was
> born, and hence no important events could have happened prior to that date.

--
Erik Lord
http://www.capemedia.net
Adobe Community Expert - eLearning
http://www.adobe.com/communities/experts/
------------------------------------------------------------------------
http://www.awaretips.net - Authorware Tips!