Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Placing Current Date on a web page

Status
Not open for further replies.

rarenet

IS-IT--Management
Jul 17, 2001
7
CA
I want to place the current date (not last modified date) on my web pages. I have DW 4. the date object only inserts the last modified date. I want the current date. Does anyone have any clues on how to do this?

Thanks
Mike


mike@geomedia.ca
 
Try using this:

Code:
<SCRIPT LANGUAGE=&quot;Javascript&quot;><!--

// ***********************************************
// AUTHOR: [URL unfurl="true"]WWW.CGISCRIPT.NET,[/URL] LLC
// URL: [URL unfurl="true"]http://www.cgiscript.net[/URL]
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts toaceDay!
// ( [URL unfurl="true"]http://www.cgiscript.net/scripts.htm[/URL] )
// ***********************************************

var aceDate=new Date()
var aceYear=aceDate.getYear()
if (aceYear < 1000)
aceYear+=1900
var aceDay=aceDate.getDay()
var aceMonth=aceDate.getMonth()+1
if (aceMonth<10)
aceMonth=&quot;0&quot;+aceMonth
var aceDayMonth=aceDate.getDate()
if (aceDayMonth<10)
aceDayMonth=&quot;0&quot;+aceDayMonth
document.write(&quot;<font color='000000' face='Arial' size='2'><b>&quot;+aceMonth+&quot;/&quot;+aceDayMonth+&quot;/&quot;+aceYear+&quot;</b></font></small>&quot;)

//--></SCRIPT>

or this...

Code:
<SCRIPT LANGUAGE=&quot;Javascript&quot;><!--

// ***********************************************
// AUTHOR: [URL unfurl="true"]WWW.CGISCRIPT.NET,[/URL] LLC
// URL: [URL unfurl="true"]http://www.cgiscript.net[/URL]
// Use the script, just leave this message intact.
// Download your FREE CGI/Perl Scripts today!
// ( [URL unfurl="true"]http://www.cgiscript.net/scripts.htm[/URL] )
// ***********************************************

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? &quot;0&quot; : &quot;&quot;)+ now.getDate();

// Calculate four digit year.
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
								}

// Join it all together
today =  days[now.getDay()] + &quot;, &quot; +
              months[now.getMonth()] + &quot; &quot; +
               date + &quot;, &quot; +
                (fourdigits(now.getYear())) ;

// Print out the data.
document.write(&quot;Today\'s date is &quot; +today+ &quot;.&quot;);
  
//--></SCRIPT>
Mike Barone
FREE CGI/Perl Scripts & JavaScript Generators
Ace PopUp Generator Software - Totally FREE
 
If you are using the date stamp extension try amending teh third line of code in the script to read :-

var lastUpdate = new Date();

Leave the rest of the code the same and it should work.

Regards

John
 
thanks, it worked, but i am not good with scripts, so i want to change the font to white, make it smaller and use arial font, whould you know how?

Thanks again.

Mike

mike@geoemdia.ca
 
document.write(&quot;<font face=arial size=2>Today\'s date is &quot; +today+ &quot;.</font>&quot;); Mike Barone
FREE CGI/Perl Scripts & JavaScript Generators
Ace PopUp Generator Software - Totally FREE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top