Sorry,
I was trying to send that to the guy who needed it.
-Mark
-----Original Message-----
From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]
Sent: Friday, June 11, 2004 1:13 PM
To: CF-Talk
Subject: Function for days and years...
This function makes sure that the days match the correct number of days for that month...
-Mark
-----Original Message-----
From: Pascal Peters [mailto:[EMAIL PROTECTED]
Sent: Friday, June 11, 2004 12:38 PM
To: CF-Talk
Subject: RE: Regular expressions in JS (or in general) for dates
function daysInMonth(y,m){
if (m == 4 || m == 6 || m == 9 || m == 11)
return 30;
else if (m == 2)
{
if (y % 4 > 0)
return 28;
else if (y % 100 == 0 && y % 400 > 0)
return 28;
else
return 29;
}
else return 31;
}
function isDate(date){
var date_pattern =
/^(0?[1-9]|1[0-2])\/(0?[1-9]|[12]\d|3[01])\/(\d{2}){1,2}$/;
if(!date_pattern.test(date)) return false;
var aDate = date.split("/");
if(aDate[2].length==2) aDate[2] = (eval(aDate[2])>30)?"19":"20"
+ aDate[2];
alert(aDate[2]+"-"+aDate[0]+"-"+aDate[1]);
if(eval(aDate[1])>daysInMonth(eval(aDate[2]),eval(aDate[0])))
return false;
return true;
}
> -----Original Message-----
> From: Mark A. Kruger - CFG [mailto:[EMAIL PROTECTED]
> Sent: vrijdag 11 juni 2004 18:41
> To: CF-Talk
> Subject: OT: Regular expressions in JS (or in general) for dates
>
> Regex gurus,
>
> I have a string and I want to ensure that the date format is:
>
> xx/xx/xxxx or x/x/xxxx or x/x/xx (you get the idea)
>
> Does anyone have a stock regex for this? Am I going to need
> more than 1 or can I look at everything (length, format and
> range of numbers) in 1 regex?
>
> -mark
>
>
>
> Mark A. Kruger, MCSE, CFG
> www.cfwebtools.com
> www.necfug.com
> http://blog.mxconsulting.com
> ...what the web can be!
>
>
>
>
>
>
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: Regular expressions in JS (or in general) for dat... Pascal Peters
- RE: Regular expressions in JS (or in general) fo... Pascal Peters
- RE: Regular expressions in JS (or in general... Mark A. Kruger - CFG
- Function for days and years... Mark A. Kruger - CFG
- Mark A. Kruger - CFG