Avatar ·

How to get current time as a formatted string in Go?

Hi! I just started learning Go and I'm having trouble with time formatting. In other languages, like Python or Java, there are simple functions like `strftime` or `SimpleDateFormat` that make it easy to get the current time in the desired format. In Go, I found the `time` package and the `time.Now()` function, but I can't figure out how to convert the returned value to a string. I tried the following code: ```go package main import ( "fmt" "time" ) func main() { currentTime := time.Now() fmt.Println(currentTime) } ``` This outputs something like `2023-10-15 14:30:45.123456789 +0300 MSK m=+0.000000001`, but I need to get the time in the format `15.10.2023 14:30:45` (day.month.year hours:minutes:seconds). I tried looking in the documentation, but it uses