Team:KULeuven/5 July 2008

From 2008.igem.org

(Difference between revisions)
Line 1: Line 1:
-
[[Team:KULeuven/Meeting_Reports | return to notebook]]
 
-
 
-
Momentarily using for test environment... don't touch anything!
 
-
 
<html>
<html>
<script type="text/javascript">
<script type="text/javascript">
-
var ndate = url_ndate_retriever();
+
var mnames = new Array('January', 'February', 'March', 'April', 'May',
 +
'June', 'July', 'August', 'September', 'October', 'November', 'December');
-
function url_ndate_retriever() {
+
function date_retriever() {
 +
// First step is to split the url of the current notebook entry
var url_tokens = location.href.split("/");
var url_tokens = location.href.split("/");
 +
// Filter out the last token which contains the proper date
var url_date_token = url_tokens[url_tokens.length-1];
var url_date_token = url_tokens[url_tokens.length-1];
Line 15: Line 14:
var month = date_tokens[1];
var month = date_tokens[1];
var year = date_tokens[2];
var year = date_tokens[2];
-
// ndate stands for numeric date, it is the date represented in milliseconds, it is not of type Date!
+
// Date is retrieved expressed in milliseconds
return Date.parse(day + ' ' + month + ', ' + year);
return Date.parse(day + ' ' + month + ', ' + year);
}
}
-
function date_yesterday(ndate) {
+
// arg determines whether you take yesterday (arg = 0) or tomorrow (arg = 1)
-
ndate -= 86400*1000;
+
function date(numeric_date, arg) {
 +
if(arg==0) numeric_date -= 86400*1000;
 +
elsif(arg==1) numeric_date += 86400*1000;
-
var yesterday = new Date();
+
var date = new Date();
-
yesterday.setTime(ndate);
+
date.setTime(numeric_date);
-
return yesterday;
+
return date;
-
}
+
-
 
+
-
function date_tomorrow(ndate) {
+
-
ndate += 86400*1000;
+
-
 
+
-
var tomorrow = new Date();
+
-
tomorrow.setTime(ndate);
+
-
 
+
-
return tomorrow;
+
}
}
Line 41: Line 33:
url += date.getDate();
url += date.getDate();
url += '_';
url += '_';
-
url += getMonthName(date.getMonth());
+
url += mnames[date.getMonth()];
url += '_';
url += '_';
url += date.getFullYear();
url += date.getFullYear();
return url;
return url;
-
}
 
-
 
-
function getMonthName(month_index) {
 
-
var mnames = new Array('January', 'February', 'March', 'April', 'May',
 
-
'June', 'July', 'August', 'September', 'October', 'November', 'December');
 
-
 
-
return mnames[month_index];
 
-
}
 
-
 
-
function test() {
 
-
hey.value = date_yesterday(url_ndate_retriever()).getMonth();
 
}
}
</script>
</script>

Revision as of 21:49, 15 July 2008

<< return to notebook