![]() |
Hey is there a javascript that tells you the date right now?
So I can say "Last Updated on: ____" and it'll just print todays date?
Its an .html age so I can I do it with php? without naming the page .php? |
yeah, simple to do without a server-side language
|
<SCRIPT language="JavaScript" type="text/javascript">
<!-- // current date - from http://rainbow.arch.scriptmania.com/scripts // Array of day names var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thu rsday","Friday","Saturday"); var monthNames = new Array("January","February","March","April","May"," June","July", "August","September","October","November","Decembe r"); var dt = new Date(); var y = dt.getYear(); // Y2K compliant if (y < 1000) y +=1900; document.write(dayNames[dt.getDay()] + ", " + monthNames[dt.getMonth()] + " " + dt.getDate() + ", " + y); // --> </SCRIPT> you can do it with php and a .html page but that is beyond the scope of this thread :) |
Code:
<script type="text/javascript"> |
Nope, it's impossible.
j/k, lol |
<SCRIPT language=JavaScript>
days = new Array(7) days[1] = "Sunday"; days[2] = "Monday"; days[3] = "Tuesday"; days[4] = "Wednesday"; days[5] = "Thursday"; days[6] = "Friday"; days[7] = "Saturday"; months = new Array(12) months[1] = "January"; months[2] = "February"; months[3] = "March"; months[4] = "April"; months[5] = "May"; months[6] = "June"; months[7] = "July"; months[8] = "August"; months[9] = "September"; months[10] = "October"; months[11] = "November"; months[12] = "December"; today = new Date(); day = days[today.getDay() + 1] month = months[today.getMonth() + 1] date = today.getDate() year=today.getYear(); if (year < 2000) year = year + 1900; document.write ("<font class='welcome' color=white> "+ day + ", " + month + " " + date + ", " + year + "</font>") // -- end hiding </SCRIPT> |
Quote:
do you know how to shorten it so it only gives todays date? Mon Jun 19 2006 15:21:36 GMT-0400 (Eastern Standard Time) I just want it to say Jun 19 2006 |
<java>
the date right now </java> |
nm got it now thanks.
|
This will do only the month and day #:
<script type="text/javascript"> document.write(Date().substring(4,10)) </script> |
| All times are GMT -7. The time now is 04:38 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123