You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
year, month, day := time.Now().Date()
fmt.Println(year, month, day) // For example 2009 November 10
fmt.Println(year, int(month), day) // For example 2009 11 10
也可以像下面这样调用单独的函数获取年、月、日
t := time.Now()
year := t.Year() // type int
month := t.Month() // type time.Month
day := t.Day() // type int
A Month specifies a month of the year (January = 1, ...).
type Month int
const (
January Month = 1 + iota
February
March
April
May
June
July
August
September
October
November
December
)
The text was updated successfully, but these errors were encountered:
把时间格式字符串解析成Time对象
Time对象格式化成字符串
Time 对象和时间戳的互换
获取时间对象的年、月、日
使用 Time 对象的 Date 方法获取时间对象的年、月、日
也可以像下面这样调用单独的函数获取年、月、日
A Month specifies a month of the year (January = 1, ...).
The text was updated successfully, but these errors were encountered: