| 2:57 pm on Feb 21, 2003 (gmt 0)|
If the site is hosted on an Apache [httpd.apache.org] server you could use mod_include [httpd.apache.org].
<!--#echo var="DATE_LOCAL" -->
The above code will insert the local date.
Of course you could use any server side scripting language as well.
[edited by: andreasfriedrich at 2:58 pm (utc) on Feb. 21, 2003]
| 2:58 pm on Feb 21, 2003 (gmt 0)|
var date = new Date();
var d = date.getDate();
var day = (d < 10)? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10)? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000)? yy + 1900 : yy;
document.write(day + "/" + month + "/" + year);
| 3:11 pm on Feb 21, 2003 (gmt 0)|
this is a useful one also.
var months=new Array(13);
var time=new Date();
var lmonth=months[time.getMonth() + 1];
if (year < 2000)
year = year + 1900;
document.write("<right>" + lmonth + " ");
document.write(date + ", " + year + "</right>");
| 3:27 pm on Feb 21, 2003 (gmt 0)|
Thanks for that, it is great help but unfortunately I dont know where to put the scripts!
Ive tried them both a few places and I usually get script error or the date just doesnt change!
| 3:33 pm on Feb 21, 2003 (gmt 0)|
Put the scripts wherever you were normally putting the date on your page. When copying and pasting, make sure you don't alter anything in the scripts above.
The only important thing really is that the script is between the <body> tags of your page. If you are using a WYSIWYG editor like Frontpage you will need to look at the source code.
If this doesn't make sense, sticky me or post and I will talk you through it.
| 3:42 pm on Feb 21, 2003 (gmt 0)|
BTW if the date is vital to your form Iīd go with a server side solution.
| 9:13 pm on Feb 22, 2003 (gmt 0)|
I'm going to point you back to this long thread, as there was some code examples included there:
| 9:26 pm on Feb 22, 2003 (gmt 0)|
| 12:26 am on Feb 23, 2003 (gmt 0)|
Some of the solutions in the above thread are server side IIRC.
| 12:41 am on Feb 23, 2003 (gmt 0)|
If your comment was addressed to me. You're right some of the solutions are server-side. I never meant to imply they weren't. But since most of the suggestions seemed to involve JS I thought it would be a good idea to point out one of the downsides of JS. :)
| 12:50 am on Feb 23, 2003 (gmt 0)|
It is a good idea GaryK, but one that does not seem to be very popular in this thread :o.