I am using this script: <http://jdpicker.paulds.fr/?p=doc> 
It's a great datepicker, but of course, the guy didn't add "mm/dd/YYYY" as one of the formats.

He claims "You can modify or add some new options by editing the switch located between lines 71 and 109. You just need to use a few regexp and some brain cells !" - well, i'm not the best with regex and I can't get this working right.

My code:

```
case "mm/dd/YYYY": 
this.reg = new RegExp(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/); 
this.date_decode = "new Date(parseInt(matches[2]-1), matches[3], matches[1]);"; 
this.date_encode = 'this.strpad(date.getMonth()+1) + "/" + this.strpad(date.getDate()) + "/" + date.getFullYear();';
this.date_encode_s = 'this.strpad(date.getMonth()+1) + "/" + this.strpad(date.getDate())';
break;

```

This was an example of a working, YYYY/mm/dd format:

```
case "YYYY/mm/dd": 
default: 
this.reg = new RegExp(/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/); 
this.date_decode = "new Date(matches[1], parseInt(matches[2]-1), matches[3]);"; 
this.date_encode = 'date.getFullYear() + "/" + this.strpad(date.getMonth()+1) + "/" + this.strpad(date.getDate());'; 
this.date_encode_s = 'this.strpad(date.getMonth()+1) + "/" + this.strpad(date.getDate());'; 
break;

```

Even after modeling after this, I couldn't get it to work. It formats the date properly, but ends up changing the calendar to the year 2038 for some reason. Any help would be great!