Team:KULeuven/Tools/New Day/Date Retriever

From 2008.igem.org

(Difference between revisions)
m
m
Line 35: Line 35:
function datePast(ndays) {
function datePast(ndays) {
var pastDate = new Date();
var pastDate = new Date();
-
ntime = pageDate().getTime();
+
var ntime = pageDate().getTime() - ndays*86400;
-
alert(ntime instanceof String);
+
-
ntime = ntime - ndays*86400;
+
pastDate.setTime(ntime);
pastDate.setTime(ntime);
Line 46: Line 44:
function dateFuture(ndays) {
function dateFuture(ndays) {
var futureDate = new Date();
var futureDate = new Date();
-
futureDate.setDate(pageDate().getDate());
+
var ntime = pageDate().getTime() + ndays*86400;
-
futureDate.setDate(futureDate.getDate() + ndays);
+
futureDate.setTime(ntime);
return futureDate;
return futureDate;

Revision as of 17:32, 1 August 2008

<< return to notebook return to homepage >>
< previous friday ← yesterday tomorrow → next monday >