Post Reply 
Y M D between dates.
01-12-2015, 12:05 PM
Post: #1
Y M D between dates.
Hi,
I sometime need to know Y M D between dates, so i use this codes :

  1 D A M J ~ E X P O R T D A M J ( D T 1 , D T 2 )
B E G I N
L O C A L a , b , c , d , e , f , g , h ;
L O C A L i , j , L ;
a : = I P ( D T 1 ) ; b : = I P ( F P ( D T 1 ) * 1 0 0 ) ;
c : = I P ( F P ( F P ( D T 1 ) * 1 0 0 ) * 1 0 0 0 0 ) ;
d : = I P ( D T 2 ) ; e : = I P ( F P ( D T 2 ) * 1 0 0 ) ;
f : = I P ( F P ( F P ( D T 2 ) * 1 0 0 ) * 1 0 0 0 0 ) ;
{ 3 1 , 2 8 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 , 3 1 , 3 0 , 3 1 , 3 0 , 3 1 } ¶%L ;
g : = d - a ; h : = 0 ;
I F ( i r e m ( c , 4 ) = = 0 A N D i r e m ( c , 1 0 0 ) `"0 ) O R
i r e m ( c , 4 0 0 ) = = 0
T H E N 2 9 ¶%L [ 2 ]
E N D ;
I F g < 0
T H E N 1 ¶%h ; g + L [ b ] ¶%g ;
E N D ;
e - b - h ¶%i ; 0 ¶%h ;
I F i < 0
T H E N 1 ¶%h ; i + 1 2 ¶%i ;
E N D ;
f - c - h ¶%j ;
P R I N T ( j + " a n ( s ) " + i + " m o i s " + g + " j o u r ( s ) " ) ;
E N D ;
[/code]

For exemple : i am borned the 21 02 1935 so i am alive for :

21.021935...12.012015 hence : 79 ans 10 mois and 19 jours.
It is more speaking then delta days=29180 days no ?
For all have a good day.
Gérard.

Gérard.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: