[Gambas-user] How to check if it is a  valid date?

Benoit Minisini gambas at ...1...
Thu Aug 19 22:13:20 CEST 2004


On Thursday 19 August 2004 17:14, Hans-Martin Bundeshund wrote:
> Salute!
>
> I tried the following code in 0.97a (also the code I
> posted  with 'Format$(act_year, "00")', what was wrong
> as I meant the following with four zeros by the
> format$-year one):
>
>
> '...
> IF IsDate(Format$(act_year,"0000") & "/" &
> Format$(act_month, "00") & "/" &
> Format$(act_day,"00")) THEN
>       datum = Date(act_year,act_month,act_day)
>     ELSE
>       message.Info("Date WRONG: " & act_day & "." &
> act_month & "." & act_year)
>     ENDIF
> '...
>
> I get non 'need date, get string'-error, but IsDate
> never is 'TRUE', but allways 'FALSE'. Where is my
> fault?
>
> regards,
>
> HM
>

IsDate() needs a US date format, and so the year must be placed at the end of 
the string, not at the beginning.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list