Team:KULeuven/5 July 2008
From 2008.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | |||
- | |||
- | |||
- | |||
<html> | <html> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
- | var | + | var mnames = new Array('January', 'February', 'March', 'April', 'May', |
+ | 'June', 'July', 'August', 'September', 'October', 'November', 'December'); | ||
- | function | + | 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]; | ||
- | // | + | // Date is retrieved expressed in milliseconds |
return Date.parse(day + ' ' + month + ', ' + year); | return Date.parse(day + ' ' + month + ', ' + year); | ||
} | } | ||
- | function | + | // arg determines whether you take yesterday (arg = 0) or tomorrow (arg = 1) |
- | + | function date(numeric_date, arg) { | |
+ | if(arg==0) numeric_date -= 86400*1000; | ||
+ | elsif(arg==1) numeric_date += 86400*1000; | ||
- | var | + | var date = new Date(); |
- | + | date.setTime(numeric_date); | |
- | return | + | return date; |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
} | } | ||
Line 41: | Line 33: | ||
url += date.getDate(); | url += date.getDate(); | ||
url += '_'; | url += '_'; | ||
- | url += | + | url += mnames[date.getMonth()]; |
url += '_'; | url += '_'; | ||
url += date.getFullYear(); | url += date.getFullYear(); | ||
return url; | return url; | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
} | } | ||
</script> | </script> |
Revision as of 21:49, 15 July 2008
<< return to notebook |