Hello, tell me how to correctly implement the date and time in Russian in go?

  • You can use the Russian-Time library by ivahaev <br> Details: Here - Urmuz Tagizade

1 answer 1

Is the date and time in Russian with the months / days of the week in words or just in a familiar format?

If just in DD.MM.YYYY HH: MM: SS, then you can

fmt.Println(time.Now().Format("02.01.2006 15:04:05"))

Unlike php, c, etc. In the standard Go package, formatting symbols are not letters with special characters, but samples. For example, 02 is the day of the month with a leading zero, 01 is the month number with a leading zero. Just 2 is the day of the month without a leading zero, etc. As a result, the time format looks like a date representation 2006-01-02T15: 04: 05.999999999Z07: 00 in the format you need.

Samples can be viewed in the time constant of the package https://golang.org/pkg/time/#pkg-constants

  • 2
    01 is the month, 02 is the day, 03 (15) is an hour, 04 is a minute, 05 is a second, (20) 06 is a year, (- / +) 07 (: 00) is a zone. Here's the cheat sheet: Mon Jan 2 03:04:05PM 2006 -0700 - Ivan Black