Zeller's Formula:

For the Gregorian calendar, Zeller's Formula is

\[\displaystyle W=\left(\left\lfloor \frac{C}{4} \right\rfloor -2C+Y+\left\lfloor \frac{Y}{4} \right\rfloor +\left\lfloor \frac{26(M+1)}{10} \right\rfloor +D-1\right)\bmod 7. \]

Where

\(W\): the day of week. (\(0 =\) Sunday, \(1 =\) Monday, ..., \(5 =\) Friday, \(6 =\) Saturday)

\(C\): the zero-based century. (\(=\lfloor \text{year}/100\rfloor= \text{century}-1\))

\(Y\): the year of the century. (\(=\begin{cases}\text{year}\bmod 100, & M=3,4,\ldots,12, \\ (\text{year}-1)\bmod 100, & M=13,14.\end{cases} ​\))

\(M\): the month. (\(3 =\) March, \(4 =\) April, \(5 =\) May, ..., \(14 =\) February)

\(D\): the day of the month.

NOTE: In this formula January and February are counted as months 13 and 14 of the previous year. E.g. if it is 2010/02/02, the formula counts the date as 2009/14/02.

For the day before 1582/10/15, notice that the time period from 1582/10/05 to 1582/10/14 does not exists. So for the day before 1582/10/15, the formula is

\[\displaystyle W=\left(\left\lfloor \frac{C}{4} \right\rfloor -2C+Y+\left\lfloor \frac{Y}{4} \right\rfloor +\left\lfloor \frac{26(M+1)}{10} \right\rfloor +D+3 \right)\bmod 7.\]

最新文章

  1. 高逼格前端开发工具-FIDDLER
  2. python2.7到python3代码转换脚本2to3的一些介绍
  3. Ubuntu 虚拟机空间不足增加空间笔记
  4. 继承自CCObject的对象成员变量出错或者为空的问题
  5. Codeforces Round #117 (Div. 2)
  6. python study - 正则表达式
  7. F - Tree
  8. Quartz1.8.5例子(一)
  9. 编程内功修炼之数据结构—BTree(一)
  10. MySQL- InnoDB锁机制
  11. 【转】你必须了解的Session的本质
  12. 浏览器未安装flash插件,js判断直接去官网安装
  13. java 线程之concurrent中的常用工具 CyclicBarrier
  14. Confluence 6 升级中的一些常见问题
  15. 洛谷P4561 [JXOI2018]排序问题(二分 期望)
  16. SpringBoot入门(0) HelloWorld的实现与原理分析
  17. day20 Python 高阶函数,函数,嵌套,闭包 装饰器
  18. Java设计模式(一)普通工场模式 抽象工场模式
  19. Python参数类型
  20. 《廖雪峰 . Git 教程》学习总结

热门文章

  1. 02:linux常用命令
  2. Encryption (hard) CodeForces - 958C3 (树状数组)
  3. linux系统内核优化参数
  4. 今天给大家分享一下js中常用的基础算法
  5. python 读excel表操作
  6. Golang中的匿名函数(闭包)
  7. maven 学习之路一
  8. Codeforces Round #581 (Div. 2) C. Anna, Svyatoslav and Maps (Floyd 算法,最短路)
  9. hive创建分区表
  10. 关于@wraps(fn)