First you can convert dd-MMM-yyyy
or MMM-dd-yyyy
format to dd-MMM-yyyy
.
By using : .replace(/([a-zA-Z]{3})-(\d{2})-(\d{4})/,"$2-$1-$3");
Then you can use REGEX : /(\d+)-([a-zA-Z]{3})-(\d{4})/
Code :
var d="DEC-16-1990";
d=d.replace(/([a-zA-Z]{3})-(\d{2})-(\d{4})/,"$2-$1-$3");
var ar=d.match(/(\d+)-([a-zA-Z]{3})-(\d{4})/);
var day=ar[1]; //16
var month=ar[2]; //DEC
var year=ar[3]; //1990
DEMO