How to convert UTC offset like this for example "UTC+02:00" to timestamp format (offset written in milliseconds)? I need to read the offset written in such way in the json file and then convert it to minutes
You can extract the values with a regular expression
/UTC([+-]\d{2}):(\d{2})/
and calculate the offset in milliseconds with
milliseconds = ((hours * 60 + minutes) * 60) * 1000
Example:
const [hours, minutes] = 'UTC-05:45'.match(/UTC([+-]\d{2}):(\d{2})/).slice(1).map(Number);
const milliseconds = Math.sign(hours) * ((Math.abs(hours) * 60 + minutes) * 60) * 1000
console.log(milliseconds);