473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
Jul 20 '05 #1
2 3464
ve*********@hotmail.com (Veerle) writes:
var modDate = new Date(document.lastModified);


Try reading <URL:http://jibbering.com/faq/#FAQ4_30>
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
On Tue, 19 Aug 2003 18:39:13 +0100, Veerle wrote
(in message <16**************************@posting.google.com>) :
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=htt...%7Evv991306%2F
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
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: knoak | last post by:
Hi there, I have a site with just a few pages. (e.g. home.php) In every page there is another page included with things like the header etc. The included file is in a subdirectory called...
5
by: What-a-Tool | last post by:
Why is it that the following code displays "2005" in IE, but "105" in every other browser I've tried? var mydt = new Date(); var myyr = mydt.getYear(); document.write("<p>Year Test :...
23
by: rithish | last post by:
<code> var dt = new Date(2004, 0, 1); alert ( dt.getDate() ); // returns proper date alert ( dt.getUTCFullYear() ); // returns 2003 </code> Why is this so? Or is that I am missing...
5
by: RICHARD BROMBERG | last post by:
I am writing an ASP program that includes a Form. When the Form is submitted I use the Date() and Time() functions to put the date and time into the Body part of the e-mail. The time reported is...
18
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
2
by: Jess | last post by:
Hello, I understand that if a function "f" has a local variable "a", and after it returns, "a" vanishes. If "f" returns "a" as a result, then I noticed the following: 1. if the return type is...
8
by: Paul E. Schoen | last post by:
I just noticed that my javascript app gives the wrong year in IE, but correct in Firefox, when I use: Form1.ApplicationDate.value = (now.getMonth()+1) + "/" + now.getDate() + "/" +...
3
by: leviwatts | last post by:
Exception Details: System.ArgumentException: DataTable already belongs to another DataSet. Googling for this error shows several post of people trying to manipulate a table within a dataset. Others...
9
by: krachor | last post by:
There appears to be some very knowledgeable people hanging around this forum so I post this question here even if it only indirectly is python related. #SEMAIL returns ERROR Is there any way of...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.