9951 explained code solutions for 126 technologies


golangHow to format time in ISO 8601 format


package main

import (
  "fmt"
  "time"
)

func main() {
	fmt.Println(time.Now().Format(time.RFC3339))
}ctrl + c
time.Now()

returns current date time

Format

formats datatime

time.RFC3339

RFC3339 format (ISO 8601 standard)