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
time: EEST timezone not recognized on windows #62065
Comments
cc @golang/windows |
I can reproduce the error using previous go releases, not only go1.21: package main
import (
"fmt"
"os"
"time"
)
func main() {
loc, err := time.LoadLocation("EEST")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(loc)
}
I don't know why it was working before for you @mohammedrefaat. The |
Go just uses the tzdata timezone database (https://github.com/eggert/tz). That database doesn't define an That said, I don't think this has much if anything to do with the WIndows abbreviation code. This code, which looks like it might correspond to the code in the original report, fails on Linux in my timezone: package main
import (
"fmt"
"os"
"time"
)
func main() {
zone, _ := time.Now().Zone()
fmt.Println(zone)
loc, err := time.LoadLocation(zone)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(loc)
} I get
This shows that the timezone abbreviations returned by Closing this issue as a dup of #5909. |
I think you need to try it on Windows, I use this code in Windows 11 22H2 os build 22621.2213 : package main
import (
"fmt"
"os"
"time"
_ "time/tzdata"
)
func main() {
te := time.Now()
zone, _ := time.Now().Zone()
fmt.Println(zone)
location_currentzone, err := time.LoadLocation(zone)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
final := te.In(location_currentzone)
fmt.Println(final)
} in go 1.20.7 EET in go 1.21.0 EEST i think zone in must return time zone EET not summer time variant of EET in go 1.21.0 |
When I run your program on my system, which is in the timezone America/Los_Angeles, I get
That happens with both tip and Go 1.20. My point is that in general it doesn't work to pass the string returned by I do see that there is a difference between Go 1.20 and Go 1.21 that affects your case, but it appears to be a change in the Windows timezone information. Every so often we update to the current version of https://raw.githubusercontent.com/unicode-org/cldr/main/common/supplemental/windowsZones.xml. When we did that for the 1.21 release, it changed "Egypt Standard Time" to return EEST for summer time. In Go 1.20 it returned EET. That was a change in the Windows timezone file, not in anything that Go controls. Hope this helps. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What did you do?
i use this code in my software work in windows
but when i upgrade go from 1.20.6 to 1.21.0
time.LoadLocation recognize only to utc and local only and didn't recognize any zone output from time.Now().Zone()
this happened in debug or build in machine have 1.21.0 golang
error:
unknown time zone EEST
The text was updated successfully, but these errors were encountered: