Date in web pages

  Dinkiz 10:42 11 Jan 2003
Locked
  Dinkiz 10:42 11 Jan 2003

Hi All,

I'm almost embaressed to ask this but does anyone out there know how I can put the date on a web page. I'm using dreamweaver 4 and all I'm looking to do is that whewn you log onto the site, it has the current date displayed as opposed to the date the page was created/updated.

Cheers,
Your blushingly,
Dinkiz :o)

  AndySD 10:52 11 Jan 2003
  Edezine 11:49 11 Jan 2003

Insert this script into a layer on your web page
Checl out my site to see it working ww.edezine.co.uk
<script language="JavaScript">

var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += (hours >= 12) ? " P.M." : " A.M."
timerRunning = true;


mydate = new Date();
myday = mydate.getDay();
mymonth = mydate.getMonth();
myweekday= mydate.getDate();
weekday= myweekday;
myyear= mydate.getYear();
year = myyear

if(myday == 0)
day = " Sunday, "

else if(myday == 1)
day = " Monday, "

else if(myday == 2)
day = " Tuesday, "

else if(myday == 3)
day = " Wednesday, "

else if(myday == 4)
day = " Thursday, "

else if(myday == 5)
day = " Friday, "

else if(myday == 6)
day = " Saturday, "

if(mymonth == 0)
month = "January "

else if(mymonth ==1)
month = "February "

else if(mymonth ==2)
month = "March "

else if(mymonth ==3)
month = "April "

else if(mymonth ==4)
month = "May "

else if(mymonth ==5)
month = "June "

else if(mymonth ==6)
month = "July "

else if(mymonth ==7)
month = "August "

else if(mymonth ==8)
month = "September "

else if(mymonth ==9)
month = "October "

else if(mymonth ==10)
month = "November "

else if(mymonth ==11)
month = "December "

if (myyear>=100&&myyear<=1900)
year = myyear + 1900;

document.write("<b><font color=#000066 face=Verdana, Arial, Helvetica size=1></b>" +day + month);
document.write(myweekday+", " + year + "</FONT>");
// -->
</script>

  Edezine 12:18 11 Jan 2003

Sorry, I forgot to add that you can alter the font colour, size etc. by adjusting the font html at the bottom of the script

  Dinkiz 15:15 11 Jan 2003

Thanks for the info re above, but I couldn't get tha tto work nor could I see it in your site.

All I want is for one line on the web page to say the date.

Any ideas?
Cheers, Dinkiz

  Edezine 17:55 11 Jan 2003

Copy all the code above starting <script language="JavaScript"> and ending </script> In Dreamweaver click 'Insert' then 'Layer'place the layer where you want the date on your page, click inside the layer to place your mouse cursor there and choose code view paste all the code into the layer (between the div tags) click on File, Preview site and the current date should be there, move the layer around to change the date position. I missed a w off the url above click here to see the date code working
Good luck

  Dinkiz 20:40 11 Jan 2003

Thanks Edezine,

I'll give it a go and let you know how I get on.

Cheers

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Fujitsu Lifebook P727 laptop review

11 best portfolio websites for designers and artists

Office for Mac buying guide: Price, Office 2017 rumours & new features

Comment désactiver les programmes qui s'exécutent au démarrage de Windows 10 ?