New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong timezone in Go #760

aral opened this Issue Jul 4, 2018 · 2 comments


None yet
2 participants
Copy link

aral commented Jul 4, 2018

I'm running Hugo on my Nexus 5 via Termux (thank you, by the way, for this amazing contribution to humanity) and when I changed the datestamp on a post manually to the current time, I noticed that Hugo did not build my post because it thought the time was in the future. That's when I realised that it had written the date stamp with a timezone of Z while creating the post instead of +01:00 (I'm on Irish Standard Time at the moment).


  • Time and timezone on the phone is set and displayed correctly
  • In a Termux session, date produces the right time and date and timezone (IST)
  • getprop persist.sys.timezone produces the correct timezone (Europe/Dublin)

To replicate

The following basic Go app produces the wrong timezone consistently for me both under plain Termux and under termux-chroot:

package main

import "time"
import "fmt"

func main() {
  p := fmt.Println
  t := time.Now()

Sample output

Wed Jul  4 16:48:28 IST 2018

getprop persist.sys.timezone

go run time.go

So Go thinks its on UTC even though we're on IST.


I’ve just verified on my Mac that this is erroneous behaviour in Termux and not an anomaly specific to Go. The output of the same script and the corresponding date results are in the screenshot below:

screen shot 2018-07-04 at 17 28 38

Update 2

As a further check, the issue does not exist in Node.js under a Termux session. The following code:

let t = new Date().toTimeString()


17:38:36 GMT +0100 (IST)

@aral aral changed the title Wrong timezone in Go Wrong timezone in Go and Node.js Jul 4, 2018

@aral aral changed the title Wrong timezone in Go and Node.js Wrong timezone in Go Jul 4, 2018


This comment has been minimized.

Copy link

fornwall commented Jul 5, 2018

Thaknks for reporting! Seems to be hitting this issue: golang/go#20455


This comment has been minimized.

Copy link

fornwall commented Jul 5, 2018

This issue was moved to termux/termux-packages#2622

@fornwall fornwall closed this Jul 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment