Reputation: 1172
I've just been given the task of updating a web page in an enterprise java web app to include the date in the page title.
Currently the web page is a static html file - what do i need to do to get the page title to be the current date in YYYY/MM/DD format? Sorry I have no idea where to start!
Upvotes: 3
Views: 488
Reputation: 46
<script language="Javascript" type="text/javascript">
alert(document.title);
document.title = (new Date()) + " --- " + document.title;
</script>
Upvotes: 3
Reputation: 13468
You have two options:
Depending on your requirements, the first option will imply less changes. With the first option, you will take the browser date, with the second, you will use the server system date. This could be important if your application is to be accessed from different time zones.
Upvotes: 1