What\'s the best way to get the current timestamp in Go and convert to string? I need both date and time in eg. YYYYMMDDhhmmss format.
For readability, best to use the RFC constants in the time package (me thinks)
import "fmt"
import "time"
func main() {
fmt.Println(time.Now().Format(time.RFC850))
}
Find more info in this post: Get current date and time in various format in golang
This is a taste of the different formats that you'll find in the previous post: