Language
Categories
Archives
- August 2017 (1)
- July 2017 (1)
- February 2017 (1)
- April 2016 (2)
- July 2014 (1)
- February 2014 (1)
- November 2013 (7)
- October 2013 (1)
- December 2012 (1)
- October 2012 (1)
- September 2012 (1)
- April 2012 (1)
- March 2012 (5)
- February 2012 (1)
- January 2012 (1)
- December 2011 (3)
- October 2011 (1)
Meta
Tags
Tag Archives: js
Two ways too show the current year in a webpage
A simple example in PHP:
<html>
<body>
<span><? echo date('Y') ?></span>
</body>
</html>
Note: PHP has to be integrated with a webserver.
A slightly less simple example in JavaScript:
<html>
<script>
function currentYear() {
y = new Date();
document.getElementById("year").innerHTML = y.getFullYear();
}
</script>
<body onload="currentYear()">
<span id="year"></span>
</body>
</html>
Should work with any JS supporting browser