<script>
var date = new Date();
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
var pass1 = Date.parse('2012/1/12');  //开始的日期
var pass2 = Date.parse(y+'/'+m+'/'+d);  //当前日期
var time = (pass2-pass1)/(1000*60*60*24);  //过去的天数
var end="已经"+time+"天"
document.write("<p>"+end+"</p>");
</script>

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.