PC Review


Reply
Thread Tools Rate Thread

Auto Insert current date on web page

 
 
Mark
Guest
Posts: n/a
 
      31st Oct 2003
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 -->


 
Reply With Quote
 
 
 
 
Peter Taurins
Guest
Posts: n/a
 
      31st Oct 2003
Try this one, the instructions are right there and it's pretty easy to
install.

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

PWT


"Mark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 -->
>
>



 
Reply With Quote
 
MD WebsUnlimited.com
Guest
Posts: n/a
 
      31st Oct 2003
Hi Mark,

If you wish to be able to control the look of the date or time format take a
look at J-Bots Date and Time components.
http://www.websunlimited.com/order/P...rrent_time.htm
--
Mike -- FrontPage MVP '97-'02
http://www.websunlimited.com
FrontPage Add-ins Since '97 2003 / 2002 / 2000 Compatible
----------------------------------------------------------------------------
--------------------
If you think I'm doing a good job, let MS know at (E-Mail Removed)

"Mark" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 -->
>
>



 
Reply With Quote
 
jon spivey
Guest
Posts: n/a
 
      31st Oct 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 -->
>
>



 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      31st Oct 2003
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" <(E-Mail Removed)> wrote in message
news:uO$$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 -->
> >
> >

>
>



 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      31st Oct 2003
Thanks Peter.

"Peter Taurins" <(E-Mail Removed)> wrote
in message news:JSsob.172736$(E-Mail Removed)...
> Try this one, the instructions are right there and it's pretty easy to
> install.
>
> http://www.john-nixon.net/codebytes/tickingtext/
>
> PWT
>
>
> "Mark" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 -->
> >
> >

>
>



 
Reply With Quote
 
Andre Rodziewicz
Guest
Posts: n/a
 
      31st Oct 2003
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
 
Reply With Quote
 
John Sitka
Guest
Posts: n/a
 
      2nd Nov 2003
Less is more

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




"Andre Rodziewicz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
Mark
Guest
Posts: n/a
 
      3rd Nov 2003
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" <(E-Mail Removed)> wrote in message
news:UW6pb.42165$(E-Mail Removed)...
> Less is more
>
> <%=FormatDateTime(Now(),1)%>
>
>
>
>
> "Andre Rodziewicz" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Current Date Save as Static Date patei Microsoft Word Document Management 1 10th Mar 2008 06:34 PM
Can I Insert a date that will automatically update when opened to 1MONTH FROM CURRENT DATE? Dori Microsoft Word New Users 2 21st Feb 2008 10:22 PM
How do I turn off the auto insert current date - Help Please =?Utf-8?B?SGFuazEyMw==?= Microsoft Word Document Management 6 16th Feb 2007 06:05 PM
How to insert future date based on current date plus 14 days =?Utf-8?B?Sm9obiBCYWtrZXI=?= Microsoft Word Document Management 1 31st Jan 2005 09:08 PM
auto insert current date Troy Microsoft Access Form Coding 5 9th Oct 2004 03:14 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:38 PM.