Created
June 4, 2020 19:04
-
-
Save stephen-soltesz/0666a0fc75e1b7192312fa709e558050 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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