Last active
December 11, 2019 08:42
-
-
Save tomowarkar/f553f2e9fe10ba67a524cdb041ee5d6f to your computer and use it in GitHub Desktop.
Goでのタイムスタンプ
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() | |
timestamp := fmt.Sprintf("%04d%02d%02d%02d%02d%02d", | |
t.Year(), t.Month(), t.Day(), | |
t.Hour(), t.Minute(), t.Second(), | |
) | |
fmt.Println(timestamp) // yyyyMMddHHmmss | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment