# Web Development > JavaScript Credit Card Expiry Date validation  for Custom Validator

## Gopinath1983

Function validateexpirydate(sender,args) { var txtvalue=args.value; var i=txtvalue.indexof('/'); var dt=new date(); var dtyear=dt.getfullyear(); var dtmonth=dt.getmonth(); var stryear=dtyear+''; var strsubstring=stryear.substring(2,4);//current year=07 var strsubstring1=stryear.substring(0,2);//current year prefix=20 if(i==2)//checking '/' character { var yearpart=txtvalue.substring(i+1,5);//checking separatley year part with textbox value var monthpart=txtvalue.substring(0,2)-1;//checking separatley month part with textbox value var currentyear=strsubstring1+yearpart;//current year prefix + user entered year if(currentyear==dtyear) { if(monthpart>=0 && monthpart<=11) { if(monthpart>dtmonth) { args.isvalid=true; return true; } else { args.isvalid=false; return false; } } else { args.isvalid=false; return false; } } else if(currentyear>dtyear) { if(monthpart>=0 && monthpart<=11) { args.isvalid=true; return true; } else { args.isvalid=false; return false; } } else { args.isvalid=false; return false; } } else { args.isvalid=false; return false; } } html code -------------------- ** *

----------


## psuresh1982

can you please edit your post to displaying clearly?  I am not able to get clearly.

There is an edit option in your post.

-----------------------
suresh

----------

