Javascript timestamps are based on the venerable UNIX time_t
data type, and show the number of milliseconds since 1970-01-01 00:00:00
UTC.
This expression gets the current time as a Javascript timestamp integer. (It does so correctly regardless of the current time_zone setting.)
ROUND(UNIX_TIMESTAMP(NOW(3)) * 1000.0, 0)
If you have TIMESTAMP
values stored in a column, you can retrieve them as integer Javascript timestamps using the UNIX_TIMESTAMP() function.
SELECT ROUND(UNIX_TIMESTAMP(column) * 1000.0, 0)
If your column contains DATETIME
columns and you retrieve them as Javascript timestamps, those timestamps will be offset by the time zone offset of the time zone they're stored in.