@@ -15,35 +15,35 @@ func strftime(t *time.Time, format string) string {
1515 // Map of strftime codes to Go format codes
1616 // Go uses the reference time: Mon Jan 2 15:04:05 MST 2006
1717 replacements := map [string ]string {
18- "%a" : "Mon" , // Abbreviated weekday name
19- "%A" : "Monday" , // Full weekday name
20- "%b" : "Jan" , // Abbreviated month name
21- "%B" : "January" , // Full month name
18+ "%a" : "Mon" , // Abbreviated weekday name
19+ "%A" : "Monday" , // Full weekday name
20+ "%b" : "Jan" , // Abbreviated month name
21+ "%B" : "January" , // Full month name
2222 "%c" : "Mon Jan 2 15:04:05 2006" , // Preferred date and time
23- "%d" : "02" , // Day of the month (01-31)
24- "%e" : "_2" , // Day of the month, space-padded ( 1-31)
25- "%H" : "15" , // Hour (00-23)
26- "%I" : "03" , // Hour (01-12)
27- "%j" : "002" , // Day of the year (001-366)
28- "%m" : "01" , // Month (01-12)
29- "%M" : "04" , // Minute (00-59)
30- "%p" : "PM" , // AM or PM
31- "%P" : "pm" , // am or pm (lowercase)
32- "%S" : "05" , // Second (00-60)
33- "%U" : "" , // Week number of year (Sunday first)
34- "%w" : "" , // Day of the week (0-6, Sunday is 0)
35- "%W" : "" , // Week number of year (Monday first)
36- "%x" : "01/02/06" , // Preferred date representation
37- "%X" : "15:04:05" , // Preferred time representation
38- "%y" : "06" , // Year without century (00-99)
39- "%Y" : "2006" , // Year with century
40- "%z" : "-0700" , // Numeric timezone offset (+0000)
41- "%Z" : "MST" , // Time zone name
42- "%%" : "%" , // Literal percent sign
23+ "%d" : "02" , // Day of the month (01-31)
24+ "%e" : "_2" , // Day of the month, space-padded ( 1-31)
25+ "%H" : "15" , // Hour (00-23)
26+ "%I" : "03" , // Hour (01-12)
27+ "%j" : "002" , // Day of the year (001-366)
28+ "%m" : "01" , // Month (01-12)
29+ "%M" : "04" , // Minute (00-59)
30+ "%p" : "PM" , // AM or PM
31+ "%P" : "pm" , // am or pm (lowercase)
32+ "%S" : "05" , // Second (00-60)
33+ "%U" : "" , // Week number of year (Sunday first)
34+ "%w" : "" , // Day of the week (0-6, Sunday is 0)
35+ "%W" : "" , // Week number of year (Monday first)
36+ "%x" : "01/02/06" , // Preferred date representation
37+ "%X" : "15:04:05" , // Preferred time representation
38+ "%y" : "06" , // Year without century (00-99)
39+ "%Y" : "2006" , // Year with century
40+ "%z" : "-0700" , // Numeric timezone offset (+0000)
41+ "%Z" : "MST" , // Time zone name
42+ "%%" : "%" , // Literal percent sign
4343 }
4444
4545 result := format
46-
46+
4747 // Replace all strftime codes with Go format codes
4848 for code , goFormat := range replacements {
4949 if goFormat == "" {
@@ -72,4 +72,3 @@ func strftime(t *time.Time, format string) string {
7272
7373 return t .Format (result )
7474}
75-
0 commit comments