getYear() returns correct year local, but wrong year online

V

Veerle

Hello,

I have made a first version of the frontpage of my new homepage. I use
the small javascript

<script type="text/javascript">
var modDate = new Date(document.lastModified);
var day = modDate.getDate();
var month = modDate.getMonth()+1;
var year = modDate.getYear();
var s = "Deze pagina werd laatst aangepast op ";
s += ((day < 10)?"0"+day:day) + "/";
s += ((month < 10)?"0"+month:month) + "/";
s += year;
s += ".";
document.writeln(s);
</script>

to print the date on which the page was last modified. When I look at
the page when it resides on my hard disk, then the date is correct:
19/08/2003. But when I put that same page online at the webspace
assigned to me by my internet provider, then the date turns into
19/08/2036. So the year is completely wrong!

I use Internet Explorer 6.0. The url of the online page is
http://home.scarlet.be/~vv991306/temp_homepage/

Any idea what I'm doing wrong here? Or is the date on the server set
wrong and is that what's causing my problem?

Thanks,
Veerle
 
N

niceguy

Hello,

I have made a first version of the frontpage of my new homepage. I use
the small javascript

<script type="text/javascript">
var modDate = new Date(document.lastModified);
var day = modDate.getDate();
var month = modDate.getMonth()+1;
var year = modDate.getYear();
var s = "Deze pagina werd laatst aangepast op ";
s += ((day < 10)?"0"+day:day) + "/";
s += ((month < 10)?"0"+month:month) + "/";
s += year;
s += ".";
document.writeln(s);
</script>

to print the date on which the page was last modified. When I look at
the page when it resides on my hard disk, then the date is correct:
19/08/2003. But when I put that same page online at the webspace
assigned to me by my internet provider, then the date turns into
19/08/2036. So the year is completely wrong!

I use Internet Explorer 6.0. The url of the online page is
http://home.scarlet.be/~vv991306/temp_homepage/

Any idea what I'm doing wrong here? Or is the date on the server set
wrong and is that what's causing my problem?

Thanks,
Veerle

Visit
http://www.samspade.org/t/safe?u=http://home.scarlet.be/~vv991306/
temp_homepage%2F

Your server date is set to 2036 - simple as that. Knowing it, you can just
subtract 33 from your getYear

Hope that helps
 

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,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top