calendar:date_to_gregorian_days/3
返回从公元零年到所给出的时间之间的天数
用法:
date_to_gregorian_days(Year, Month, Day) -> Days
内部实现:
-spec date_to_gregorian_days(Year, Month, Day) -> Days when Year :: year(), Month :: month(), Day :: day(), Days :: non_neg_integer(). date_to_gregorian_days(Year, Month, Day) when is_integer(Day), Day > 0 -> Last = last_day_of_the_month(Year, Month), if Day = dy(Year) + dm(Month) + df(Year, Month) + Day - 1 end.
获取从公元零年到 Year 年 Month 月 Day 日之间的天数:
calendar:date_to_gregorian_days(1970, 1, 1).
calendar:date_to_gregorian_days(2013, 9, 18).