I use this code to get utc offset in hours:
new Date().getTimezoneOffset() / 60;
But it always returns me -2 even thou my timezone is actualy +1 why is that happening?
EDIT if i change my computer time zone to UTC +2 it returns -3, really strange..
That is the expected behavior.
Date.getTimezoneOffset()returns the offset from UTC to your locale, hence the negative to the number you expect.The reason why a +2 locale would return -3, is possible because of daylight saving effects, perhaps.