Forum Discussion
See also this thread How to obtain difference btw 2 timestamp?
Yes I have found the solution using the getTime() but its limited to date-time datatype. If suppose the datatype may vary facing undefined getTime issue for local-date-time and etc.
date difference:
Math.floor(($date1.getTime() - $date2.getTime() ) / (1000 * 60 * 60 * 24))