Date format problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dumlee
Forum Commoner
Posts: 33
Joined: Mon Jun 30, 2008 12:06 am

Date format problem

Post by dumlee »

can u pls help me in finding out that why the following code is not accepting mm/dd/yyyy changes


['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example 17/03/2006 for the 17th of March, 2006.', function(v) {
if(Validation.get('IsEmpty').test(v)) return true;
var regex = /^(\d{2})\/(\d{2})\/(\d{4})$/;
if(!regex.test(v)) return false;
var d = new Date(v.replace(regex, '$2/$1/$3'));
return ( parseInt(RegExp.$2, 10) == (1+d.getMonth()) ) &&
(parseInt(RegExp.$1, 10) == d.getDate()) &&
(parseInt(RegExp.$3, 10) == d.getFullYear() );
}]
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

Re: Date format problem

Post by WebbieDave »

That isn't PHP code. You should try a Javascript forum.
dumlee
Forum Commoner
Posts: 33
Joined: Mon Jun 30, 2008 12:06 am

Re: Date format problem

Post by dumlee »

Ok Sir Thanks
Post Reply