Click to See Complete Forum and Search --> : searching a string


rcamp
05-15-2003, 08:32 AM
I need to check whether a user has entered a correct date, some dates that are being put into the system have the year as 0003 and not 2003 - don't ask me why !! but it is causing all kinds of problems....

I want to check the string for a correct year...I have looked at using indexOf or atChar but they seem to return its number in the string, can anyone help me with this please ??

Thanks in advance

RC

Gollum
05-15-2003, 08:49 AM
use parseInt to convert the string to a number...

var y = parseInt(oTxtBox.value);
if ( y < 1900 ) alert("That's a long time ago!");