github.com/tursom/GoCollections@v0.3.10/util/time/time.go (about) 1 package time 2 3 import ( 4 "time" 5 ) 6 7 type Time = time.Time 8 9 // A Month specifies a month of the year (January = 1, ...). 10 type Month = time.Month 11 12 const ( 13 January = time.January 14 February = time.February 15 March = time.March 16 April = time.April 17 May = time.May 18 June = time.June 19 July = time.July 20 August = time.August 21 September = time.September 22 October = time.October 23 November = time.November 24 December = time.December 25 ) 26 27 // A Weekday specifies a day of the week (Sunday = 0, ...). 28 type Weekday = time.Weekday 29 30 const ( 31 Sunday = time.Sunday 32 Monday = time.Monday 33 Tuesday = time.Tuesday 34 Wednesday = time.Wednesday 35 Thursday = time.Thursday 36 Friday = time.Friday 37 Saturday = time.Saturday 38 ) 39 40 type Duration = time.Duration 41 42 const ( 43 Nanosecond = time.Nanosecond 44 Microsecond = time.Microsecond 45 Millisecond = time.Millisecond 46 Second = time.Second 47 Minute = time.Minute 48 Hour = time.Hour 49 ) 50 51 // Now returns the current local time. 52 func Now() Time { 53 return time.Now() 54 } 55 56 func Unix(sec int64, nsec int64) Time { 57 return time.Unix(sec, nsec) 58 } 59 60 func UnixMilli(msec int64) Time { 61 return time.UnixMilli(msec) 62 } 63 64 func UnixMicro(usec int64) Time { 65 return time.UnixMicro(usec) 66 } 67 68 func Date(year int, month Month, day, hour, min, sec, nsec int, loc *Location) Time { 69 return time.Date(year, month, day, hour, min, sec, nsec, loc) 70 }