programming-examples/js/Date/Write a JavaScript function to get timezone offset in seconds..js
2019-11-15 12:59:38 +01:00

10 lines
253 B
JavaScript

function timezone_offset_in_seconds(dt)
{
return -dt.getTimezoneOffset() * 60;
}
dt = new Date();
console.log(timezone_offset_in_seconds(dt));
dt = new Date(1989, 10, 1);
console.log(timezone_offset_in_seconds(dt));