|
| |
|
|
cesar
Posts: 2 Joined: 6/5/2003 Status: offline
|
Automatic dates - 7/3/2003 10:49:35
I wish to include the day, month and year at the top of a website. It must change completely automatic every time somebody checks upon these pages. Any help? I thank you all in advance for you troubles and time.
|
|
|
|
Gil
Posts: 7533 From: North Carolina, USA Status: offline
|
RE: Automatic dates - 7/3/2003 11:00:51
What date/time - server or visitor?
_____________________________
Gil Harvey, 1947-2004
|
|
|
|
abbeyvet
Posts: 5095 From: Kilkenny Ireland Status: offline
|
RE: Automatic dates - 7/3/2003 11:21:57
f it is visitor time, I like this way, though there are shorter scripts. Shows it in this format: Thursday, 3 July 2003 <script language=" JavaScript" >
<!-- Hide the script
var today=new Date();
var months=new Array(13);
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" ;
var lmonth=months[today.getMonth() + 1];
var date=today.getDate();
var year=today.getFullYear();
var dayno = today.getDay() + 1;
if(dayno==1) day = " Sunday" ;
if(dayno==2) day = " Monday" ;
if(dayno==3) day = " Tuesday" ;
if(dayno==4) day = " Wednesday" ;
if(dayno==5) day = " Thursday" ;
if(dayno==6) day = " Friday" ;
if(dayno==7) day = " Saturday" ;
var thedate= (day + " , " + date + " " + lmonth + " " + year);
document.write(thedate);
// end hiding-->
</script> You could just use this, but it is not so pretty and includes the time: Thu Jul 03 16:06:36 2003 <SCRIPT>
document.write(Date())
</SCRIPT> Or you can get more elaborate and have this: Good afternoon, it is Thursday, 3 July 2003 <script language=" JavaScript" >
<!-- Hide the script
var today=new Date();
var months=new Array(13);
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" ;
var lmonth=months[today.getMonth() + 1];
var date=today.getDate();
var year=today.getFullYear();
var dayno = today.getDay() + 1;
if(dayno==1) day = " Sunday" ;
if(dayno==2) day = " Monday" ;
if(dayno==3) day = " Tuesday" ;
if(dayno==4) day = " Wednesday" ;
if(dayno==5) day = " Thursday" ;
if(dayno==6) day = " Friday" ;
if(dayno==7) day = " Saturday" ;
hr = today.getHours();
if ((hr >= 1) && (hr <=5)) {
t = " Good morning, it is " ;}
if ((hr >= 6) && (hr <=11)) {
t = " Good morning, it is " ;}
if ((hr >= 12) && (hr <=16)) {
t = " Good afternoon, it is " ;}
if ((hr >= 17) && (hr <=21)) {
t = " Good evening, it is " ;}
if ((hr == 22) || (hr ==23)) {
t = " Good evening, it is " ;}
if (hr==0) {
t = " Good night" ;}
var thedate= (t + day + " , " + date + " " + lmonth + " " + year);
document.write(thedate);
// end hiding-->
</script>
You can also do it with SSI rather than JavaScript if you are on a Unix platform, or with ASP on Windows. To use any of those just paste the scripts into the page (in HTML view) whereever you want the date to appear.
< Message edited by abbeyvet -- 7/3/2003 11:28:08 AM >
_____________________________
Katherine :: InKK Design :: InKK Domains
|
|
|
|
paperfish
Posts: 181 From: None Status: offline
|
RE: Automatic dates - 7/4/2003 7:53:34
For server time, I like to use SSI. This example below shows both the today' s date and the date the page was last revised: <!--#config timefmt=" %B %d, %Y" --> <table border=" 0" cellpadding=" 0" cellspacing=" 0" width=" 100%" > <tr> <td width=" 50%" align=" center" > <p class=" SOPIntror1c1" >Today is: <!--#echo var=" DATE_LOCAL" --> </p> </td> <td width=" 50%" align=" center" > <p class=" SEPDate" >Date Last Revised: <!--#echo var=" LAST_MODIFIED" --> </p> </td> </tr> </table> You can customize the date display by changing the parameters for " config timefmt"
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|