Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Auto Display Date?

Quote Reply
Auto Display Date?
Novice question here: How do I set it so I can have the web page display the current date? I'd prefer not to use server side includes, so I guess my only other option is java. any advice?
thanks,
duane
Quote Reply
Re: Auto Display Date? In reply to
You can use <%date%> and <%time%> in the templates to get the date and time the pages were last rebuilt. Is this what you are looking for? If you want the current date and time, you'll want to use javascript, or SSI.

Cheers,

Alex
Quote Reply
Re: Auto Display Date? In reply to
First off - sorry about posting this in this forum - I meant to do it in the perl/cgi forum.
I want to automatically display the current date every day on the front page of my site. So java or SSI will be the solution. I'd prefer java, so does anybody have the javascript code they can post or point me towards.
thanks,
duane
Quote Reply
Re: Auto Display Date? In reply to
Code:
<script language="JavaScript">
<!--
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
document.write(months[date.getMonth()] + " " + date.getDate() + ", " + date.getYear());
//-->
</script>

you can use that one and format it to look like whatever you want.. or..

Code:
<script>document.write(Date())</script>

but it will look like this

Mon Jan 17 16:00:10 2000

------------------
Jerry Su
Links SQL Licensed
------------------



[This message has been edited by widgetz (edited January 17, 2000).]
Quote Reply
Re: Auto Display Date? In reply to
oops.. i had a y2k bug in the first one Smile

netscape's problem..

Code:
<script language="JavaScript">
<!--
var months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
var date = new Date();
var year = date.getYear();
if (year < 2000) year += 1900;
document.write(months[date.getMonth()] + " " + date.getDate() + ", " + year);
//-->
</script>

------------------
Jerry Su
Links SQL Licensed
------------------
Quote Reply
Re: Auto Display Date? In reply to
Cool. Thanks! Works like a charm!

[This message has been edited by dnason (edited January 17, 2000).]