Difference between revisions of "P5js-calendar-weekday"
From Digipool-Wiki
(Created page with " <pre> var myDate = new Date(); var wochentag = new Array(7); var myWochentag; function setup() { createCanvas(400, 400); wochentag[0] = "Sonntag"; wochentag[1] = "Mo...") |
|||
Line 5: | Line 5: | ||
var wochentag = new Array(7); | var wochentag = new Array(7); | ||
var myWochentag; | var myWochentag; | ||
+ | var tomorrow; | ||
function setup() { | function setup() { | ||
Line 19: | Line 20: | ||
myDate.setYear(2017); | myDate.setYear(2017); | ||
myDate.setMonth(11); // 0 - 11 | myDate.setMonth(11); // 0 - 11 | ||
− | myDate.setDate( | + | myDate.setDate(31); // 1 - 31 (30,28 ...) |
+ | |||
+ | tomorrow = new Date(myDate.getTime() + (24 * 60 * 60 * 1000)); | ||
myWochentag = wochentag[myDate.getDay()]; | myWochentag = wochentag[myDate.getDay()]; | ||
Line 27: | Line 30: | ||
background(220); | background(220); | ||
text(myDate + " = " + myWochentag, 10, 50); | text(myDate + " = " + myWochentag, 10, 50); | ||
+ | text(tomorrow, 10, 100); | ||
} | } | ||
</pre> | </pre> |
Latest revision as of 13:44, 9 March 2018
var myDate = new Date(); var wochentag = new Array(7); var myWochentag; var tomorrow; function setup() { createCanvas(400, 400); wochentag[0] = "Sonntag"; wochentag[1] = "Montag"; wochentag[2] = "Dienstag"; wochentag[3] = "Mittwoch"; wochentag[4] = "Donnerstag"; wochentag[5] = "Freitag"; wochentag[6] = "Sammstag"; myDate.setYear(2017); myDate.setMonth(11); // 0 - 11 myDate.setDate(31); // 1 - 31 (30,28 ...) tomorrow = new Date(myDate.getTime() + (24 * 60 * 60 * 1000)); myWochentag = wochentag[myDate.getDay()]; } function draw() { background(220); text(myDate + " = " + myWochentag, 10, 50); text(tomorrow, 10, 100); }