Q:

Getting time between dates

I'm trying to write a countdown and it should expires on a MySQL datetime value.
Using JavaScript I can get today's time using new Date()).getTime() but then how can I get the time difference from JS date and the MySQL datetime, assuming MySQL datetime value is in the future

A:

getTime() gives you the number of milliseconds since 1970-01-01.
Convert the MySQL datetime object to JS format, and then you can subtract the milliseconds and see the difference.

