Skip to content

Instantly share code, notes, and snippets.

@stephen-soltesz
Created June 4, 2020 19:04
Show Gist options
  • Save stephen-soltesz/0666a0fc75e1b7192312fa709e558050 to your computer and use it in GitHub Desktop.
Save stephen-soltesz/0666a0fc75e1b7192312fa709e558050 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
"cloud.google.com/go/civil"
"github.com/m-lab/go/rtx"
)
func main() {
ti1, err := time.Parse(time.RFC3339, "2020-05-01T23:59:59Z")
rtx.Must(err, "failed to parse utc")
ti2, err := time.Parse(time.RFC3339, "2020-05-01T23:59:59-04:00")
rtx.Must(err, "failed to parse -4")
ti3, err := time.Parse(time.RFC3339, "2020-05-02T00:00:01+04:00")
rtx.Must(err, "failed to parse +4")
fmt.Println(
ti1, civil.DateOf(ti1), "\n",
ti2, civil.DateOf(ti2), "\n",
ti3, civil.DateOf(ti3))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment