I saw the time format "0102150405" in the code, but I don't know what's the format is, Does anyone have an idea about it?
time.Now().UTC().Format("0102150405")
I saw the time format "0102150405" in the code, but I don't know what's the format is, Does anyone have an idea about it?
time.Now().UTC().Format("0102150405")
(January 2, 15:04:05, 2006, in time zone seven hours west of GMT).
That value is recorded as the constant named Layout, listed below.
As a Unix time, this is 1136239445. Since MST is GMT-0700,
the reference would be printed by the Unix date command as:
Mon Jan 2 15:04:05 MST 2006
You can use it to format the time value you got.
0102150405 means want to format time.Now() as string like "${month}${day}${hour}${minute}${second}".
Here is a summary of the components of a layout string. Each element shows by example the formatting of an element of the reference time. Only these values are recognized. Text in the layout string that is not recognized as part of the reference time is echoed verbatim during Format and expected to appear verbatim in the input to Parse.
Year: "2006" "06"
Month: "Jan" "January" "01" "1"
Day of the week: "Mon" "Monday"
Day of the month: "2" "_2" "02"
Day of the year: "__2" "002"
Hour: "15" "3" "03" (PM or AM)
Minute: "4" "04"
Second: "5" "05"
AM/PM mark: "PM"
See more: