problem with lastModified


It seems that the whole Y2K thing has had an effect on javascript.  Here is
my problem.

I wish to post a last modified on my page.  It should read, "This page was
last modified on Jan 7, 2000.  There are two problems with this.

The first problem lies in the fact that the date is set back to 0.  Can this
be remedied with a  simple (y==y:2000+y:y)?  

The second problem is that the date from the call, document.lastModified
displays a time that is incorrect.  It shows a time that is exactly eight
hours ahead.  I am in the Pacific Time Zone that happens to be eight hours
ahead of Grenwich mean time.  How can I change the time so that it reflects
the correct time here?

The code for a simple lastModified is as follows:

<html><head><body><script language="JavaScript"><!-- Begin

document.write('<center>Last updated : ');

// End --></script></p></body></html>

The date on this code is affected by the eight hour gap too.   Why is this
and how can it be changed for it to work properly in Vancouver?

<script language="JavaScript">
function date_ddmmmyyyy(date)
  var d = date.getDate();
  var m = date.getMonth() + 1;
  var y = date.getYear();

  // could use splitString() here 
  // but the following method is 
  // more compatible
  var mmm = 
    ( 1==m)?'Jan':( 2==m)?'Feb':(3==m)?'Mar':
    ( 4==m)?'Apr':( 5==m)?'May':(6==m)?'Jun':
    ( 7==m)?'Jul':( 8==m)?'Aug':(9==m)?'Sep':

  return "" +
    mmm + " " +
    d + ", " +

// get last modified date of the 
// current document.
function date_lastmodified()
  var lmd = document.lastModified;
  var s   = "Unknown";
  var d1;

  // check if we have a valid date
  // before proceeding
  if(0 != (d1=Date.parse(lmd)))
    s = "" + date_ddmmmyyyy(new Date(d1));

  return s;

  "This page was updated on " + 
  date_lastmodified() );

// -->

Thank you.  Please reply to my e-mail address.



Received on Friday, 7 January 2000 12:25:56 UTC