Date on web pages
A while back, I asked someone to help me get the current date on my site. Here is the code they gave me:
<!--begin date-->
<td align="right"><font color="black" face="Verdana,Arial,Helvetica,Geneva" size="1">
<!--#config timefmt="%A, %B %d %Y"-->
<!--#echo var="DATE_LOCAL"-->
</font></td>
<!--end date-->
Since it doesn't give the time, it never dawned on me that it was not EVEN in my time zone. Is there a way to do that? For example, it is only 9:30 p.m. here (CST) but the date on my site has been Feb. 14th for hours now!
Thanks in advance.
Carole
------------------
up to 25% discount on knives, cutlery & sharpeners: Millennium Cutlery
Military & Combat Knives. Hunting & Fishing Knives. Pocket Knives.
Kitchen Cutlery. Sharpeners.
Enter our Monthly Drawing!!
Suzanne posted this at 05:42 — 14th February 2000.
She has: 5,507 posts
Joined: Feb 2000
It's the local time where your SERVER is, not you.
I don't know how to alter it, maybe with a -howmany hours.
Cheers,
Suzanne
------------------
Zero Cattle
Suzanne
Tables DeMystified
Anonymous posted this at 08:59 — 14th February 2000.
They have: 5,633 posts
Joined: Jan 1970
if you want it to show the day and month that you are currently in, this following code works
NSS posted this at 11:42 — 14th February 2000.
They have: 488 posts
Joined: Feb 2000
Try this script:
<SCRIPT LANGUAGE=Javascript>
calendar = new Date();
day = calendar.getDay();
month = calendar.getMonth();
date = calendar.getDate();
year = calendar.getYear();
if (year< 100) year = 1900 + year;
cent = parseInt(year/100);
g = year % 19;
k = parseInt((cent - 17)/25);
i = (cent - parseInt(cent/4) - parseInt((cent - k)/3) + 19*g + 15) % 30;
i = i - parseInt(i/28)*(1 - parseInt(i/28)*parseInt(29/(i+1))*parseInt((21-g)/11));
j = (year + parseInt(year/4) + i + 2 - cent + parseInt(cent/4)) % 7;
l = i - j;
emonth = 3 + parseInt((l + 40)/44);
edate = l + 28 - 31*parseInt((emonth/4));
emonth--;
var dayname = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthname =
new Array ("January","February","March","April","May","June","July","August","September","October","November","December" );
document.write(dayname[day] + ", ");
document.write(monthname[month] + " ");
if (date< 10) document.write("0" + date + ", ");
else document.write(date + ", ");
document.write(year + " <font color=000000>");
document.write("</font>");
</SCRIPT>
Control the color,font size or bold like this:
<FONT COLOR="#FF0000" FACE="ARIAL" SIZE=2 >
<B>
<SCRIPT>
the code
</SCRIPT>
</B>
</FONT>
This script will give the date, month and year on the user's browser when they login to your site.(based on the user's cpu data a.m. or p.m.)
NSS http://www.unitronics.com
[This message has been edited by NSS (edited 14 February 2000).]
[This message has been edited by NSS (edited 14 February 2000).]
[This message has been edited by NSS (edited 14 February 2000).]
tiny posted this at 15:08 — 14th February 2000.
They have: 89 posts
Joined: Jul 1999
Thank you all so much. You've been VERY helpful. Glad I came here for this.
Double OK ~ the format is exactly what I want.
I do believe I will go with NSS's script, only because I'd like my customers to feel that it's personalized to their time zone.
Do you think it should show the current time? Of course, I don't have a clue how to do that, but if it's not a LOT more code, do you think it would be beneficial?
In other words, do you have the time on your sites?
thanks again!
Carole
------------------
up to 25% discount on knives, cutlery & sharpeners: Millennium Cutlery
Military & Combat Knives. Hunting & Fishing Knives. Pocket Knives.
Kitchen Cutlery. Sharpeners.
Enter our Monthly Drawing!!
NSS posted this at 15:43 — 14th February 2000.
They have: 488 posts
Joined: Feb 2000
glad the script is of help.The time is on most viewer's browser if they are using win95 is at the bottom right-hand corner and in my opinion it's not needed unless you would want to display two different time.
For more on Javascript, visit: http://javascript.internet.com
You can find lots of scripts of you requirements.
Also please be aware that when you are using Javascript, if the visitor's browser for Javascript is not enable, the visitor will not be able to see it.
NSS http://www.unitronics.com
[This message has been edited by NSS (edited 14 February 2000).]
[This message has been edited by NSS (edited 14 February 2000).]
tiny posted this at 15:51 — 14th February 2000.
They have: 89 posts
Joined: Jul 1999
perfect! thanks!
Carole
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.