Format
Constants#
Format#
func Format(t time.Time, formatStr string) string
Format the date in a commonly used format:
List of all available formats#
| Format | Output |
|---|---|
| YY | 18 |
| YYYY | 2018 |
| M | 1-12 |
| MM | 01-12 |
| MMM | Jan-Dec |
| MMMM | January-December |
| D | 1-31 |
| DD | 01-31 |
| d | 0-6 |
| dd | Su-Sa |
| ddd | Sun-Sat |
| dddd | Sunday-Saturday |
| H | 0-23 |
| HH | 00-23 |
| h | 1-12 |
| hh | 01-12 |
| m | 0-59 |
| mm | 00-59 |
| s | 0-59 |
| ss | 00-59 |
| sss | 000-999 |
| A | AM PM |
| a | am pm |
Supported languages#
| Language | Name |
|---|---|
| English | glocale.ENUS |
| Chinese (Simplified) | glocale.ZHCN |
| 繁体中文(中国香港) | glocale.ZHHK |
| 繁体中文(中国香港) | glocale.ZHTW |