github.com/Aoi-hosizora/ahlib@v1.5.1-0.20230404072829-241b93cf91c7/xtime/README.md (about) 1 # xtime 2 3 ## Dependencies 4 5 + (xtesting) 6 7 ## Documents 8 9 ### Types 10 11 + `type JsonDate time.Time` 12 + `type JsonDateTime time.Time` 13 + `type Clock interface` 14 15 ### Variables 16 17 + `var UTC Clock` 18 + `var Local Clock` 19 20 ### Constants 21 22 + `const RFC3339DateTime string` 23 + `const CJKDateTime string` 24 + `const RFC3339Date string` 25 + `const CJKDate string` 26 27 ### Functions 28 29 + `func SetYear(t time.Time, year int) time.Time` 30 + `func SetMonth(t time.Time, month int) time.Time` 31 + `func SetDay(t time.Time, day int) time.Time` 32 + `func SetHour(t time.Time, hour int) time.Time` 33 + `func SetMinute(t time.Time, minute int) time.Time` 34 + `func SetSecond(t time.Time, second int) time.Time` 35 + `func SetMillisecond(t time.Time, millisecond int) time.Time` 36 + `func SetMicrosecond(t time.Time, microsecond int) time.Time` 37 + `func SetNanosecond(t time.Time, nanosecond int) time.Time` 38 + `func SetLocation(t time.Time, loc *time.Location) time.Time` 39 + `func ToDate(t time.Time) time.Time` 40 + `func ToDateTime(t time.Time) time.Time` 41 + `func ToDateTimeNS(t time.Time) time.Time` 42 + `func LocationDuration(loc *time.Location) time.Duration` 43 + `func GetTimeLocation(t time.Time) *time.Location` 44 + `func GetLocalLocation() *time.Location` 45 + `func ParseTimezone(timezone string) (*time.Location, error)` 46 + `func TruncateTime(t time.Time, du time.Duration) time.Time` 47 + `func DurationNanosecondComponent(d time.Duration) int` 48 + `func DurationMicrosecondComponent(d time.Duration) int` 49 + `func DurationMillisecondComponent(d time.Duration) int` 50 + `func DurationSecondComponent(d time.Duration) int` 51 + `func DurationMinuteComponent(d time.Duration) int` 52 + `func DurationHourComponent(d time.Duration) int` 53 + `func DurationDayComponent(d time.Duration) int` 54 + `func DurationTotalNanoseconds(d time.Duration) int64` 55 + `func DurationTotalMicroseconds(d time.Duration) int64` 56 + `func DurationTotalMilliseconds(d time.Duration) int64` 57 + `func DurationTotalSeconds(d time.Duration) float64` 58 + `func DurationTotalMinutes(d time.Duration) float64` 59 + `func DurationTotalHours(d time.Duration) float64` 60 + `func DurationTotalDays(d time.Duration) float64` 61 + `func NewJsonDate(t time.Time) JsonDate` 62 + `func NewJsonDateTime(t time.Time) JsonDateTime` 63 + `func ParseJsonDate(s string) (JsonDate, error)` 64 + `func ParseJsonDateOr(s string, d JsonDate) JsonDate` 65 + `func ParseJsonDateTime(s string) (JsonDateTime, error)` 66 + `func ParseJsonDateTimeOr(s string, d JsonDateTime) JsonDateTime` 67 + `func CustomClock(t *time.Time) Clock` 68 + `func StrftimeInBytes(pattern []byte, t time.Time) ([]byte, error)` 69 + `func StrftimeInString(pattern string, t time.Time) (string, error)` 70 + `func TestStrftimeToGlobPattern(t *testing.T)` 71 72 ### Methods 73 74 + `func (d JsonDate) Time() time.Time` 75 + `func (d JsonDate) String() string` 76 + `func (d JsonDate) MarshalJSON() ([]byte, error)` 77 + `func (d *JsonDate) UnmarshalJSON(bytes []byte) error` 78 + `func (d *JsonDate) Scan(value interface{}) error` 79 + `func (d JsonDate) Value() (driver.Value, error)` 80 + `func (dt JsonDateTime) Time() time.Time` 81 + `func (dt JsonDateTime) String() string` 82 + `func (dt JsonDateTime) MarshalJSON() ([]byte, error)` 83 + `func (dt *JsonDateTime) UnmarshalJSON(bytes []byte) error` 84 + `func (dt *JsonDateTime) Scan(value interface{}) error` 85 + `func (dt JsonDateTime) Value() (driver.Value, error)`