Team:KULeuven/Tools/New Day/Date Retriever
From 2008.igem.org
(Difference between revisions)
m |
m |
||
Line 21: | Line 21: | ||
var month; | var month; | ||
for (x in monthNames) { | for (x in monthNames) { | ||
- | if(dateTokens[1] == monthNames[x]) {month = parseInt(x) | + | if(dateTokens[1] == monthNames[x]) {month = parseInt(x); break;} |
} | } | ||
var year = parseInt(dateTokens[2]); | var year = parseInt(dateTokens[2]); | ||
Line 28: | Line 28: | ||
var date = new Date(); | var date = new Date(); | ||
date.setFullYear(year, month, day); | date.setFullYear(year, month, day); | ||
- | + | ||
return date; | return date; | ||
} | } | ||
Line 35: | Line 35: | ||
function datePast(ndays) { | function datePast(ndays) { | ||
var pastDate = new Date(); | var pastDate = new Date(); | ||
- | |||
alert(pastDate.toGMTString()); | alert(pastDate.toGMTString()); | ||
+ | pastDate.setDate(pageDate().getDate() - ndays); | ||
return pastDate; | return pastDate; | ||
} | } |
Revision as of 10:25, 1 August 2008
<< return to notebook | return to homepage >> | ||
< previous friday | ← yesterday | tomorrow → | next monday > |