Ad

Convert Timezone Offset "+00:00" To Minutes

- 1 answer

I have a function that returns timezone offset strings (like "+03:00") And I want to convert this string to minutes offset("+03:00" should turn to 180) using moment.js or built-in plain javascript options

How can I do that?

Ad

Answer

I've found the solution:

moment().utcOffset("+03:00").utcOffset() // returns 180
moment().utcOffset("-09:00").utcOffset() // returns -540
Ad
source: stackoverflow.com
Ad