03-05-2024, 11:28 PM
(03-05-2024, 11:13 PM)Kernelpanic Wrote:For something like DateDiff, if you convert the date and time units to UNIX time / epoch in a common time zone, isn't it just plain addition & subtraction? Then you just convert epoch back to standard date?Quote:@mdijkens - You can do these and other date/time related things very easy with the library I posted above.Thank you for your hint. The key point about "DateDiff" is, how should I use that for calculations?
Just add to your program and calculate differences, leapyear, weekdays, daylight saving, timezones, etc.
I know "DateDiff" from VB-Script and from Visual Basic, and there I used it for calculations in financial programs. I was able to use the result of “DateDiff” when calculating the repayment amount of loans.
Back then, I recalculated all formulas and results in all programs using a calculator, and when "DateDiff" was used, for example, it always delivered a correct result.
There can't be even the slightest mistake in finance. . . otherwise the Third World War will break out.
I do think it would be useful if QB64PE added a native DateTime type like in VB6 / VBA / VBScript, with datediff and dateadd functions, but I think epoch should be able to handle most cases?