Team:KULeuven/Tools/New Day/Date Retriever

From 2008.igem.org

(Difference between revisions)
(New page: <html> <script type="text/javascript"> var mnames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); fu...)
Line 3: Line 3:
var mnames = new Array('January', 'February', 'March', 'April', 'May',
var mnames = new Array('January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October', 'November', 'December');
'June', 'July', 'August', 'September', 'October', 'November', 'December');
 +
 +
var dnames = new Array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
function date_retriever() {
function date_retriever() {
Line 42: Line 44:
return url;
return url;
 +
}
 +
 +
function date_next_week_monday() {
 +
var numeric_date = date_retriever();
 +
 +
var this_day = new Date();
 +
this_day.setTime(numeric_date);
 +
 +
var day_of_week = this_day.getDay();
 +
switch(day_of_week) {
 +
case 0: numeric_date += 86400*1000;
 +
default: numeric_date += (8-day_of_week)*86400*1000;
 +
}
 +
 +
var next_monday = new Date();
 +
next_monday.setTime(numeric_date);
 +
 +
return next_monday;
}
}
Line 55: Line 75:
<td width="25%"><script language="javascript">document.write("< yesterday".link(url_date(date(0))));</script></td>
<td width="25%"><script language="javascript">document.write("< yesterday".link(url_date(date(0))));</script></td>
<td width="25%"><script language="javascript">document.write("tomorrow >".link(url_date(date(1))));</script></td>
<td width="25%"><script language="javascript">document.write("tomorrow >".link(url_date(date(1))));</script></td>
-
<td width="25%"></td>
+
<td width="25%"><script language="javascript">document.write("next monday >>".link(url_date(date_next_week_monday())));</script></td>
</tr>
</tr>
</table>
</table>

Revision as of 07:41, 16 July 2008

<< return to notebook