- Home
·
- Math/Dates
·
- To calculate number of days elapsed between two dates. (Using Julian Date Method)
To calculate number of days elapsed between two dates. (Using Julian Date Method)
To calculate number of days elapsed between two dates. (Using Julian Date Method)
API Declarations
'
'
'
Rate To calculate number of days elapsed between two dates. (Using Julian Date Method)
(1(1 Vote))
*
pmmdd1 = substr(porgdt1,5,4)
pmmdd2 = substr(porgdt2,5,4)
*
n_mmdd1 = val(pmmdd1)
n_mmdd2 = val(pmmdd2)
*
pyy1 = substr(porgdt1,1,4)
pyy2 = substr(porgdt2,1,4)
*
n_yy1 = val(pyy1)
n_yy2 = val(pyy2)
*
pmm1 = substr(porgdt1,5,2)
pmm2 = substr(porgdt2,5,2)
*
n_mm1 = val(pmm1)
n_mm2 = val(pmm2)
*
sk_juldt()
*
retu
***
FUNCTION sk_juldt
*
sele b
use judb inde jmmdd
seek n_mmdd1
if found()
n_days1 = jday
endi
seek n_mmdd2
if found()
n_days2 = jday
endi
*
if n_yy2 > n_yy1
if (n_yy2 - n_yy1) > 1
days = days + 365*(n_yy2 - n_yy1 - 1)
if n_mm2 = n_mm1
if n_days2 > n_days1
days = days + (n_days2 - n_days1) + 365
endi
if n_days2 = n_days1
days = days + 365
endi
if n_days2 < n_days1
days = days + (365 - (n_days1 - n_days2))
endi
endi
if n_mm2 > n_mm1
days = days + (n_days2 - n_days1) + 365
endi
if n_mm2 < n_mm1
days = days + n_days2 + (365 - n_days1)
endi
endi
if (n_yy2 - n_yy1) = 1
if n_mm2 = n_mm1
if n_days2 > n_days1
days = days + (n_days2 - n_days1) + 365
endi
if n_days2 = n_days1
days = days + 365
endi
if n_days2 < n_days1
days = days + (365 - (n_days1 - n_days2))
endi
endi
if n_mm2 > n_mm1
days = days + (n_days2 - n_days1) + 365
endi
if n_mm2 < n_mm1
days = days + n_days2 + (365 - n_days1)
endi
endi
endi
if n_yy2 = n_yy1
if (n_mm2 > n_mm1) .or. (n_mm2 = n_mm1)
days = days + (n_days2 - n_days1)
endi
endi
retu days
To calculate number of days elapsed between two dates. (Using Julian Date Method) Comments
No comments yet — be the first to post one!
Post a Comment