Hi! What actually happens with Date - Date is when you try and convert Date into a number it gives you the milliseconds since 1970 - so you could just replace one of the dates with that.
Otherwise to create a Date you can do new Date(args) where args is either nothing (current time), one numeric argument (milliseconds since 1970), a date string (see Date.parse), or [year, month, day, hour, minute, second, millisecond].
If supplying a String you can do '2011-10-20T14:48:00', '2011-10-20' or 'Mon, 25 Dec 1995 13:30:00 +0430'
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi! What actually happens with
Date - Date
is when you try and convertDate
into a number it gives you the milliseconds since 1970 - so you could just replace one of the dates with that.Otherwise to create a Date you can do
new Date(args)
whereargs
is either nothing (current time), one numeric argument (milliseconds since 1970), a date string (see Date.parse), or [year, month, day, hour, minute, second, millisecond].If supplying a String you can do '2011-10-20T14:48:00', '2011-10-20' or 'Mon, 25 Dec 1995 13:30:00 +0430'
Hope that's some help!