擅长:python、mysql、java
<p>如果两个日期都是<code>datetime.date</code>对象,则要计算今天和另一个日期之间的天数:</p>
<pre><code>from datetime import date
number_of_days = date.today().toordinal() - other_date.toordinal()
</code></pre>
<p>它没有考虑到时区相关的问题,它假设你错写了“朱利安日期”。在</p>
<p>顺便说一句,从9月25日到10月6日有11天:</p>
^{pr2}$
<p>要在不使用日期时间模块的情况下执行此操作,您需要执行一些简单的算法。日历每400年重复一次,见<a href="http://en.wikipedia.org/wiki/Leap_year#Gregorian_calendar" rel="nofollow">the algorithm</a>。在</p>