How to the current date and time in UTC with Go

1 Answer

0 votes
package main
  
import (
    "fmt"
	"time"
)
  
func main() {
	loc, err := time.LoadLocation("UTC")
    if err != nil {
        fmt.Println(err)
    }
    
	now := time.Now().In(loc)
	
	fmt.Println(now)
}
 
 

 
/*
run:
 
2020-08-16 13:50:18.906852853 +0000 UTC
 
*/

 



answered Aug 16, 2020 by avibootz

Related questions

1 answer 211 views
1 answer 266 views
1 answer 268 views
1 answer 346 views
1 answer 257 views
257 views asked Aug 7, 2020 by avibootz
1 answer 307 views
7 answers 854 views
854 views asked Aug 7, 2020 by avibootz
...