In JavaScript we can use this method to get the offset zone.
function myFunction() {
var d = new Date();
var n = d.getTimezoneOffset();
document.getElementById("demo").innerHTML = n;
}
For example , if we are in Berlin , Germany we return -120 minutes. If we are in London we have -60 minutes.
I need exactly that method in golang. Exists??? Thanks to every one.
The
time.Time
type has what you're looking for:zone
the the timezone name, and offset is its UTC offset. Pretty simpleExample on the playground: http://play.golang.org/p/Ij-TuuRX_K