get date (for today, tommorrow, in 2 days....)

F

François Laroche

hey guys,

I need help with a script:

<script>

var dayarray=new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi")
var montharray=new Array("Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym

var cdate="<small><font color='000000'
face='Arial'><b>"+dayarray[day]+" "+daym+" "+montharray[month]+"
"+year+"</b></font></small>"

if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1)
}

</script>
<span id="clock"></span>

There is my problem, this script will show me the date, and it works,
perfectly, but I need to make some change... I want it to show me
today's date, the date of tomorrow AND the date in 2 days.

for example, I want it to show:
April 30, 2004 (<---------today's date)
May 1, 2004
May 2, 2004

and if you are wondering why I need this... there will be a link
beside each date to download the teetimes of the day (working in a
golf club, and Im the webmaster)

Thx for your help!
and sorry if my english isn't prefect....

-Frank
 
K

kaeli

hey guys,

I need help with a script:
and if you are wondering why I need this... there will be a link
beside each date to download the teetimes of the day (working in a
golf club, and Im the webmaster)

If it is an internet site, you need to realize that some people don't
have javascript enabled. This sort of thing, which is intrinsic to the
functioning of the site, is best done in a server-side script so all
clients can access it.
IMO, it's also a lot easier to implement server-side, but that's just my
opinion. YMMV.
Do you have a server-side scripting language, such as ASP, JSP, or PHP?

--
 
M

Mick White

kaeli wrote:

If it is an internet site, you need to realize that some people don't
have javascript enabled. This sort of thing, which is intrinsic to the
functioning of the site, is best done in a server-side script so all
clients can access it.

One can take a snapshot of GMT both server-side and client-side, and
compare the two results(if both are present).
Mick
 
F

Fran?ois Laroche

IMO, it's also a lot easier to implement server-side, but that's just my
No I don't have such server-side...... what do you suggest me to learn
between asp jsp and php?

-Frank
 
M

Mick White

Fran?ois Laroche said:
No I don't have such server-side...... what do you suggest me to learn
between asp jsp and php?

-Frank

What server side languages does your host provide?
Rule of thumb:
Linux/Apache server : PHP is probably available
Windows server: ASP

As far as javascript:

function daysFromNow(num){// num=integer
var d=new Date();
d.setDate(d.getDate()+num)
return d;
}
Mick
 
K

kaeli

No I don't have such server-side...... what do you suggest me to learn
between asp jsp and php?

-Frank

That depends on what your server (host) has.
Once you know one, they're all pretty easy to pick up. They all support
pretty much the same kinds of things, just the syntax is different.

PHP is free and so is the apache web server, so if you want to play,
more than likely you could install both on your home computer.

Mick's post provided the javascript for the date stuff for the interim.

--
 
F

Fran?ois Laroche

That depends on what your server (host) has.
Once you know one, they're all pretty easy to pick up. They all support
pretty much the same kinds of things, just the syntax is different.

PHP is free and so is the apache web server, so if you want to play,
more than likely you could install both on your home computer.

Mick's post provided the javascript for the date stuff for the interim.

--

ok thx a lot guys, I will see what the host can provide me.

-Frank
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top