Skip to content

Instantly share code, notes, and snippets.

@juarezpaf
Created April 28, 2010 20:23
Show Gist options
  • Select an option

  • Save juarezpaf/382656 to your computer and use it in GitHub Desktop.

Select an option

Save juarezpaf/382656 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
<script>
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1);
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
}
var today = new Date();
var weekno = today.getWeek();
alert(weekno);
</script>
</head>
<body>
<p id="hello">Hello World</p>
</body>
</html>​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment