I found here a solution with a onKeypress, that I adapt to use through a listener. What's the best way to automatically insert slashes '/' in date fields
You should find the way to adapt it adding the time.
For me, and only with date format work properly in those ways: you can add all in the input like this:
<input id="txtDate" name=x size=10 maxlength=10 onkeydown="this.value=this.value.replace(/^(\d\d)(\d)$/g,'$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g,'$1/$2').replace(/[^\d\/]/g,'')">
I'm using in this way with a listener:
function checkFecha() {
this.value = this.value.replace(/^(\d\d)(\d)$/g, '$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/[^\d\/]/g, '');}
txtDate.addEventListener('keydown', checkMyDate, false);
So in my case, the input don't contain the "onkeydown".
Regards!