Avatar ·

Formatting current time in Go in yyyyMMddHHmmss format

Hi everyone! I just started learning Go and encountered a problem with time formatting. I need to get the current date and time in a format similar to Java: yyyyMMddHHmmss, to use in a log file name.\n\nI tried writing code, but it outputs something strange:\n\n```go\npackage main\n\nimport (\n "fmt"\n "time"\n)\n\nfunc main() {\n now := time.Now()\n fmt.Println(now.Format("yyyyMMddHHmmss"))\n}\n```\n\nInstead of the expected "20250315143022", I get "yyyymmddHHmmss" — literally the format string. I know that in other languages (Java, Python) this works differently. In Python, I would write `datetime.now().strftime("%Y%m%d%H%M%S")`, and it would work.\n\nI read the Go documentation for the time package, but there's some strange format with "Mon Jan 2 15:04:05 MST 2006". I'm completely confused. Why