package mainimport "fmt"import "time"func main() {t := time.Now()loc, err := time.LoadLocation("America/New_York")if err != nil {fmt.Printf("Error: %s\n", err)}fmt.Printf("UTC %s, Local time: %s, tz %s\n", t.UTC().Format(time.RFC3339), t.In(loc).Format(time.RFC3339), loc.String())}
Error: unknown time zone America/New_York panic: time: missing Location in call to Time.In
And on my mac this program worked fine,output:UTC 2014-02-26T15:56:58Z, Local time: 2014-02-26T10:56:58-05:00, tz America/New_York
Just want to make sure that I didn't created a bug in my code that could be triggered on other platforms.The location information is pulled from the local filesystem. Most systems will support it but it does depend what is loaded on the particular system. As always, catch and handle your errors ☺
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.