| iMatix home page | << | < | > | >> |
SFL Version 2.11 |
#include "sfldate.h" long date_to_days (long date)
Converts the date into a number of days since a distant but unspecified epoch. You can use this function to calculate differences between dates, and forward dates. Use days to date() to calculate the reverse function. Author: Robert G. Tantzen, translated from the Algol original in Collected Algorithms of the CACM (algorithm 199). Original translation into C by Nat Howard, posted to Usenet 5 Jul 1985.
{ long year = GET_YEAR (date), century = GET_CENTURY (date), month = GET_MONTH (date), day = GET_DAY (date); if (month > 2) month -= 3; else { month += 9; if (year) year--; else { year = 99; century--; } } return ((146097L * century) / 4L + (1461L * year) / 4L + (153L * month + 2L) / 5L + day + 1721119L); }
| << | < | > | >> | Copyright © 1996-2000 iMatix Corporation |