Created
June 17, 2020 12:30
-
-
Save arindamroynitw/78885588175e55d706e60daf57ded55e to your computer and use it in GitHub Desktop.
This file contains 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" | |
) | |
func main() { | |
t := time.Now() | |
formatted := t.Format(time.RFC1123) | |
fmt.Printf("Raw time variable is %v, formatted to RFC1123 is %v \n", t, formatted) | |
parsedTime, err := time.Parse(time.RFC1123, formatted) | |
if err != nil { | |
fmt.Printf("error in parsing time is %v", err) | |
} else { | |
fmt.Printf("Input string provided is %v and time variable generated is %v", formatted, parsedTime) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment