We would like to know how to convert RFC 822 date to valid Date.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
<!--from www. j av a2 s . c om-->
var sOriginalDate = 'Thu Sep 08 2011 12:00:00 GMT-0400 (EDT)';
var oDate = new Date(sOriginalDate);
var iMonth = oDate.getMonth() + 1;
var iDay = oDate.getDate();
var sNewDate = oDate.getFullYear() + '-'
+ (iMonth < 10 ? '0' : '') + iMonth + '-'
+ (iDay < 10 ? '0' : '') + iDay;
document.writeln(sNewDate);
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: