Forum Moderators: phranque

Message Too Old, No Replies

Java Script for Dates

Does anyone have a small java script for auto date?

         

aaronjf

8:57 pm on Sep 29, 2002 (gmt 0)

10+ Year Member



Does anyone have a date script? Java scripting is not my bag.

mack

9:19 pm on Sep 29, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Here is one I had saved in a text file and have never used. I gave it a quick try on local system and it seamed to work ok.

<script language=JavaScript>
<!--display date-->
;today = new Date(); weekday = today.getDay();if (weekday == 6) document.write('Saturday');if (weekday == 0) document.write('Sunday');if (weekday == 1) document.write('Monday');if (weekday == 2) document.write('Tuesday');if (weekday == 3) document.write('Wednesday');if (weekday == 4) document.write('Thursday');if (weekday == 5) document.write('Friday');document.write(', '); month = today.getMonth();if (month == 0) document.write('Jan');if (month == 1) document.write('Feb');if (month == 2) document.write('Mar');if (month == 3) document.write('April');if (month == 4) document.write('May');if (month == 5) document.write('June');if (month == 6) document.write('July');if (month == 7) document.write('Aug');if (month == 8) document.write('Sept');if (month == 9) document.write('Oct');if (month == 10) document.write('Nov');if (month == 11) document.write('Dec');date = today.getDate(); document.write (' ', date, ' ')
</script>

jdMorgan

9:24 pm on Sep 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



aaronjf,

The following code will use javascript or SSI if available to show the current date and time in default format. I just snipped this out of one of my old pages; You can delete the <noscript> section if you don't want to (or can't) use SSI.

<script Language="JavaScript" type="text/JavaScript"><!-- // hide from old browsers
document.write('<center><font size="-2" face="Arial,Helvetica">Current Date/Time: ' + new Date() + '</font></center>');
// -->
</script>
<noscript>
<center><font face="Arial,Helvetica" size="-2"> <!--#echo var="DATE_LOCAL" --> </font></center>
</noscript>

Jim

aaronjf

9:26 pm on Sep 29, 2002 (gmt 0)

10+ Year Member



Thanks guys, that was perfect

keyplyr

9:57 pm on Sep 29, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I just use this:

<script language="javascript" type="text/javascript">document.write(Date())</script>