Standard library / time

time.Time.UTC()

Return the same instant in UTC and strip any monotonic reading. Expected stdout: '2024-01-01T00:00:00Z\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) UTC() Time

Return Value

Time

Return the same instant in UTC and strip any monotonic reading.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func main() {  fmt.Println(time.Date(2024, 1, 1, 2, 0, 0, 0, time.FixedZone("Plus2", 7200)).UTC().Format(time.RFC3339))}
Go Reference