Hi,
Is there a way to get the number of days since a specific date (without SkStuff)?
Thanks in advance.
EDIT: Solved
A Unix timestamp is the amount of seconds elapsed since January 1, 1970. If you subtract the current amount of seconds from the amount of seconds of the date you want, and then divide it by 84600 (there are 84600 seconds in a day), you get the number of elapsed days. Since unix timestamps are floats and might not be whole numbers, you should round the result down using floor().
Is there a way to get the number of days since a specific date (without SkStuff)?
Thanks in advance.
EDIT: Solved
Code:
function daysSince(d: date) :: integer:
set {_diff} to floor((unix timestamp of now - unix timestamp of {_d}) / 86400)
return {_diff}
Last edited: