We would like to know how to fetch day of the week based on a specific date as '2014-05-20'.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!-- w ww . j a v a 2s. co m-->
var givendate = '2014-05-20';
var date = new Date(givendate);
document.writeln(date.getDay());
}
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: