/    Sign up×
Community /Pin to ProfileBookmark

document.lastmodified always gives current date

Hi, i’m using document.lastmodified but each time i refresh the page, it doesn’t give me the last modified date..what it gives me is the current date and i don’t know what’s wrong..anyone can help? i couldn’t find any place that talks about this problem.

Any help on understanding what’s wrong is appreciated..

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@AdamGundryAug 03.2004 — Check you are capitalising it correctly (document.lastModified) - JS is case sensitive. Alternately, could you show us the code you are using or a link to the page. It may be a problem with the server you are using.

Adam
Copy linkTweet thisAlerts:
@seangohauthorAug 04.2004 — This is the code....

============================

function initArray()
{
this.length = initArray.arguments.length
for (var i=0;i<this.length;i++)
this[i+1] = initArray.arguments[i]
}
// end initArray.
var DOWArray = new initArray("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var MOYArray = new initArray("January", "February", "March", "April", "May", "June", "July", "August","September", "October", "November", "December");
var LastModDate = new Date(document.lastModified);


document.write (DOWArray[(LastModDate.getDay()+1)],", ");
document.write (MOYArray[(LastModDate.getMonth()+1)]," ");
document.write (LastModDate.getDate(),", ",(LastModDate.getFullYear()));

==================================


I think it's the server because when i tried different servers, some work while some didn't. what do u think i should do?
Copy linkTweet thisAlerts:
@AdamGundryAug 04.2004 — The code looks fine, so I think you are right - it's more likely to be the server. Are you using dynamic pages (created using PHP, for example)? In that case, the server may set the last modified date to the current date. Alternately, you could contact the server administrator and ask them to fix it.

Adam
Copy linkTweet thisAlerts:
@seangohauthorAug 04.2004 — no that's not inserted into a dynamic page...i'll contact the server admin..thanks!
×

Success!

Help @seangoh spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...