We would like to know how to parse String as '2013-12-01 03:22:03' to date.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
function conv(str) {<!-- w w w. j a va 2 s .c om-->
var d=new Date(str.replace(/-/g,"/"));
var day = d.getDate();
if (day<10) day ="0"+day;
var yyyy=""+d.getFullYear();
return ""+day +" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][d.getMonth()]+" '"+yyyy.substring(2);
}
var dStr = conv("2013-12-01 03:22:03");
document.writeln(dStr);
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: