Auto Insert current date on web page

M

Mark

Hi,

I'm currently in the process of building a new website, and would like to
have the current date automatically inserted into the top right hand side of
the web page.

I have found this piece of code on the web, but cant seem to make it work.
Any ideas, or any simpler ways of achieving this???

Thanks...

<!-- Begin
d = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
m = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
);

today = new Date();
day = today.getDate();
year = today.getYear();

if (year < 2000)
year = year + 1900;

end = "th";
if (day==1 || day==21 || day==31) end="st";
if (day==2 || day==22) end="nd";
if (day==3 || day==23) end="rd";
day+=end;

document.write(" ");
document.write(d[today.getDay()]+" "+m[today.getMonth()]+" ");
document.write(day+" " + year);
document.write(" ");
// End -->
 
J

jon spivey

Hi Mark,
That code is good. The only thing you should do is wrap it in a function and
then call it wherever on the page you want the date to appear. See this page
for a demo - you can copy and paste the code back to your own page
http://www.roksteady.net/mark.htm

Jon
Microsoft MVP - FP
 
M

Mark

Excellent.

I have pasted the code into my page, and the result is exactly as I wanted.
However, I can't see what I have done in normal mode in FP 2002. It just
appears blank.

Also, could you please explain what you mean by wrap it in a function. I
just pasted the html and it worked. Although, all the other code appears to
have the code </tr> or </td> before anything else. What is that?

Thanks,

Mark

jon spivey said:
Hi Mark,
That code is good. The only thing you should do is wrap it in a function and
then call it wherever on the page you want the date to appear. See this page
for a demo - you can copy and paste the code back to your own page
http://www.roksteady.net/mark.htm

Jon
Microsoft MVP - FP

Mark said:
Hi,

I'm currently in the process of building a new website, and would like to
have the current date automatically inserted into the top right hand
side
of
the web page.

I have found this piece of code on the web, but cant seem to make it work.
Any ideas, or any simpler ways of achieving this???

Thanks...

<!-- Begin
d = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
m = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
);

today = new Date();
day = today.getDate();
year = today.getYear();

if (year < 2000)
year = year + 1900;

end = "th";
if (day==1 || day==21 || day==31) end="st";
if (day==2 || day==22) end="nd";
if (day==3 || day==23) end="rd";
day+=end;

document.write(" ");
document.write(d[today.getDay()]+" "+m[today.getMonth()]+" ");
document.write(day+" " + year);
document.write(" ");
// End -->
 
M

Mark

Thanks Peter.

Peter Taurins said:
Try this one, the instructions are right there and it's pretty easy to
install.

http://www.john-nixon.net/codebytes/tickingtext/

PWT


Mark said:
Hi,

I'm currently in the process of building a new website, and would like to
have the current date automatically inserted into the top right hand
side
of
the web page.

I have found this piece of code on the web, but cant seem to make it work.
Any ideas, or any simpler ways of achieving this???

Thanks...

<!-- Begin
d = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
m = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
);

today = new Date();
day = today.getDate();
year = today.getYear();

if (year < 2000)
year = year + 1900;

end = "th";
if (day==1 || day==21 || day==31) end="st";
if (day==2 || day==22) end="nd";
if (day==3 || day==23) end="rd";
day+=end;

document.write(" ");
document.write(d[today.getDay()]+" "+m[today.getMonth()]+" ");
document.write(day+" " + year);
document.write(" ");
// End -->
 
A

Andre Rodziewicz

Copy the following JavaScript into Notepad and then paste into your
cell – In FP2000 Insert > Advanced > html.

<SCRIPT language=JavaScript><!--

var DayOfWeek = 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');
var theDate = new Date();

document.write('<NOBR>' +
DayOfWeek[theDate.getDay()] + ' ' +
MonthName[theDate.getMonth()] + ' ' +
theDate.getDate() + ', ' +
(theDate.getYear() < 200 ? theDate.getYear() + 1900 :
theDate.getYear()) +
'</font></NOBR>');
//--></SCRIPT>

===============
Andre Rodziewicz
WimbledonVisitor.Com
The Wimbledon Business Directory
Search Engine Optimisation and Web Design
Helping Your business reach the world
http://www.wimbledonvisitor.com/products
 
M

Mark

Many thanks for all the help everyone.

I went with Jon's idea in the end. It does exactly what I wanted.

Many thanks Jon...


John Sitka said:
Less is more

<%=FormatDateTime(Now(),1)%>




Andre Rodziewicz said:
Copy the following JavaScript into Notepad and then paste into your
cell - In FP2000 Insert > Advanced > html.

<SCRIPT language=JavaScript><!--

var DayOfWeek = new
Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'
);
var MonthName = new
Array('January','February','March','April','May','June','July','August','Sep
tember',
'October','November','December');
var theDate = new Date();

document.write('<NOBR>' +
DayOfWeek[theDate.getDay()] + ' ' +
MonthName[theDate.getMonth()] + ' ' +
theDate.getDate() + ', ' +
(theDate.getYear() < 200 ? theDate.getYear() + 1900 :
theDate.getYear()) +
'</font></NOBR>');
//--></SCRIPT>

===============
Andre Rodziewicz
WimbledonVisitor.Com
The Wimbledon Business Directory
Search Engine Optimisation and Web Design
Helping Your business reach the world
http://www.wimbledonvisitor.com/products
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top