Quantcast
Channel: LiveCode Forums
Viewing all articles
Browse latest Browse all 780

Getting Started with LiveCode - Experienced Developers • Re: Day of Project (subtracting calendar days

$
0
0
Hi Bruce,

here I post a library made by Malte Brill (derBrill) which he has put it into the public domain in 2014.

It has a very complete variety of handlers for I guess for most calendar related problems.

for days between dates you would have to add 1 to the result since you want to include the first date

CODE:

-- from Malte Brill's libDatefunction libDate_DaysBetween pYear1,pMonth1,pDay1,pYear2,pMonth2,pDay2   return libDate_DayNumber(pYear2,pMonth2,pDay2) - libDate_DayNumber(pYear1,pMonth1,pDay1)end libDate_DaysBetween-- taken from http://alcor.concordia.ca/~gpkatch/gdate-algorithm.htmlfunction libDate_DayNumber pYear,pMonth,pDayput  (pMonth + 9) mod 12 into pMonthput pYear - pMonth div 10 into pYearreturn 365*pYear + pYear div 4 - pYear div 100 + pYear div 400 + (pMonth*306 + 5) div 10 + ( pDay - 1 )end libDate_DayNumber

The complete library is attached here.

Kind regards
Bernd
libDate.rev.zip

Statistics: Posted by bn — Fri Jun 21, 2024 11:28 am



Viewing all articles
Browse latest Browse all 780

Trending Articles