以下方程和值使用 Java/Javscript 给出不同的输出: Javascript:
var dayOfWeek = parseInt((dayOfMonth + 26 * (monthOfYear +1) / 10 + yearOfCentury + yearOfCentury / 4 + century / 4 + 5 * century) % 7);
爪哇:
int dayOfWeek = (dayOfMonth + 26 * (monthOfYear +1) / 10 + yearOfCentury + yearOfCentury / 4 + century / 4 + 5 * century) % 7; code here
如果 dayOfMonth =28,monthOfYear =7,yearOfCentury = 9,世纪=20
Java 返回 dayOfWeek = 3(这是正确的!) JS 返回 dayOfWeek = 4!(奇怪的)
任何反馈表示赞赏。