How to find difference between two dates?

I am trying to find the number of days between two dates. Is there any way to find it in CROSS PLATFORM?

Hello, this is a snippet from a project I made to calculate the differences between two dates (although the second date is the current date, so you’ll just have to replace it). Please note this does not include year, my project did not need that. You can just check if the years are equal and if not add 365 (check if it is a leap year, though).

Sorry this is not a complete answer, it’s just to give you a starting place and some ideas.


So I was looking for a non-API way of doing this, and I stumbled across Julian dates. Pretty nerdy, but there is an explanation here: and countless more explanations online, but I found this the simplest to put into blocks. Julian dates takes into account leap years and leap centuries, and this is a mathematically accepted way of finding the difference between two dates. In this example, the date picked FDOM is converted to a Julian date DOM. My variables L, M, S correspond to a, y, and m, respectively, in this link with the formula. To find the difference between two dates, subtract the Julian dates.