The date.getTimezoneOffset() method is used to return the time difference between Universal Coordinated Time (UTC) and local time, in minutes. If your time zone is GMT+5, -300 (60*5) minutes will be returned. Daylight savings prevent this value from being constant.
Parameter: This method does not accept any parameter.
Return Values: It returns a number representing the time difference between UTC and Local Time in minutes.
Below are examples of Date.getTimezoneOffset() method.
Example 2: The date of the month should lie in between 1 to 31 because none of the months have a date greater than 31 that is why it returns NaN i.e, not a number because the date for the month does not exist.
Example 3: In this example, we will leave the new Date blank to get the time difference between UTC and local time by a trigger.
Note: The Universal Coordinated Time (UTC) is the time set by the World Time Standard. UTC is the same as GMT time.
- Google Chrome
- Internet Explorer
- Mozilla Firefox
Please Login to comment...