getUTCHours() to read Hour of GMTWe know how to get local computer ( client computer ) time by using getHours function. However to get the UTC time or GMT we have to use getUTCHours function. This function uses the local time setting and calculates the corresponding GMT time. We can check the difference between the two but before that here is the syntax with an example.
We can compare the output using getHours() and getUTCHours()
Here is the output of above code.
You can see the difference in getHours and getUTCHours in above code. You can also read the difference in these two times by using getTimezoneOffset() function
This article is written by plus2net.com team.