Last active
December 23, 2015 09:29
-
-
Save SMoni/6614579 to your computer and use it in GitHub Desktop.
... mit JavaScript."Die Berechnung erfolgt nach dem C++-Algorithmus von Ekkehard Hess aus einem Beitrag vom 29.7.1999 in der Newsgroup borland.public.cppbuilder.language (freigegeben zur allgemeinen Verwendung)"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getWeek = function() { | |
var a = Math.floor((14 - (this.getMonth())) / 12); | |
var y = this.getYear() + 4800 - a; | |
var m = (this.getMonth()) + (12 * a) - 3; | |
var jd = this.getDate() - 2 + Math.floor(((153 * m) + 2) / 5) + (365 * y) + Math.floor(y / 4) - Math.floor(y / 100) + Math.floor(y / 400) - 32045; | |
^ Offset auf Montag | |
var d4 = (jd + 31741 - (jd % 7)) % 146097 % 36524 % 1461; | |
var L = Math.floor(d4 / 1460); | |
var d1 = ((d4 - L) % 365) + L; | |
return Math.floor(d1 / 7) + 1; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment