Wednesday,
10th Mar 2010
Paul

[javascript]

Date Script

There are quite a few date scripts floating around but this one has always been reliable and came through the Year2K issues with flying colours! It is very simple to use. Firstly, cut and paste the script below in between the <head> tags in your document:

Now, wherever you want the date to appear on your page, you put this line of code:

<script language="JavaScript" type="text/javascript">returnDate();</script>

...and that's all there is to it. You can use CSS to create a different appearance for your date - for example, in the code below I have put a div around the entire script with specific attributes in the div:

<div style="font: normal bold 1.2em/1.6em monospace; color: #007BB1; text-align: center;">
  <script language="JavaScript" type="text/javascript">returnDate();</script> </div>

which will render like this on the page:

The date will automatically change each day so with just a glance, visitors know what the current date is. This is a very useful addition, particularly to business sites.