You are here: irt.org | FAQ | JavaScript | Date | Q549 [ previous next ]
The date foramt has to be altered to:
Wed, 26 Aug 1998 14:40:45
So:
<script language="JavaScript"><!-- var textdate = 'Wed Aug 26 14:40:45 MET DST 1998.'; var myArray = textdate.split(' '); var input = myArray[0] + ', ' + myArray[2] + ' ' + myArray[1] + ' ' + myArray[3] + ' ' + myArray[6].substring(0,4); var output = Date.parse(input); var mydate = new Date(output) //--></script>