time

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: 0BSD Imports: 0 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ANSIC = "Mon Jan _2 15:04:05 2006"
View Source
const DateOnly = "2006-01-02"
View Source
const DateTime = "2006-01-02 15:04:05"
View Source
const Kitchen = "3:04PM"
View Source
const Layout = "01/02 03:04:05PM '06 -0700"
View Source
const RFC1123 = "Mon, 02 Jan 2006 15:04:05 MST"
View Source
const RFC1123Z = "Mon, 02 Jan 2006 15:04:05 -0700"
View Source
const RFC822 = "02 Jan 06 15:04 MST"
View Source
const RFC822Z = "02 Jan 06 15:04 -0700"
View Source
const RFC850 = "Monday, 02-Jan-06 15:04:05 MST"
View Source
const RubyDate = "Mon Jan 02 15:04:05 -0700 2006"
View Source
const Stamp = "Jan _2 15:04:05"
View Source
const StampMicro = "Jan _2 15:04:05.000000"
View Source
const StampMilli = "Jan _2 15:04:05.000"
View Source
const StampNano = "Jan _2 15:04:05.000000000"
View Source
const TimeOnly = "15:04:05"
View Source
const UnixDate = "Mon Jan _2 15:04:05 MST 2006"

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration int64
const Hour Duration = 3600000000000
const Microsecond Duration = 1000
const Millisecond Duration = 1000000
const Minute Duration = 60000000000
const Nanosecond Duration = 1
const Second Duration = 1000000000

func ParseDuration

func ParseDuration(s string) (Duration, error)

func Since

func Since(t Time) Duration

func Until

func Until(t Time) Duration

func (Duration) Abs

func (Duration) Abs() Duration

func (Duration) Hours

func (Duration) Hours() float64

func (Duration) Microseconds

func (Duration) Microseconds() int64

func (Duration) Milliseconds

func (Duration) Milliseconds() int64

func (Duration) Minutes

func (Duration) Minutes() float64

func (Duration) Nanoseconds

func (Duration) Nanoseconds() int64

func (Duration) Round

func (Duration) Round(m Duration) Duration

func (Duration) Seconds

func (Duration) Seconds() float64

func (Duration) String

func (Duration) String() string

func (Duration) Truncate

func (Duration) Truncate(m Duration) Duration

type Location

type Location struct {
	// contains filtered or unexported fields
}
var UTC *Location

func FixedZone

func FixedZone(name string, offset int) *Location

func LoadLocationFromTZData

func LoadLocationFromTZData(name string, data []byte) (*Location, error)

func (*Location) String

func (*Location) String() string

type Month

type Month int
const April Month = 4
const August Month = 8
const December Month = 12
const February Month = 2
const January Month = 1
const July Month = 7
const June Month = 6
const March Month = 3
const May Month = 5
const November Month = 11
const October Month = 10
const September Month = 9

func (Month) String

func (Month) String() string

type ParseError

type ParseError struct {
	Layout     string
	Value      string
	LayoutElem string
	ValueElem  string
	Message    string
}

func (*ParseError) Error

func (*ParseError) Error() string

type Time

type Time struct {
	// contains filtered or unexported fields
}

func Date

func Date(year int, month Month, day int, hour int, min int, sec int, nsec int, loc *Location) Time

func Now

func Now() Time

func Parse

func Parse(layout string, value string) (Time, error)

func ParseInLocation

func ParseInLocation(layout string, value string, loc *Location) (Time, error)

func Unix

func Unix(sec int64, nsec int64) Time

func UnixMicro

func UnixMicro(usec int64) Time

func UnixMilli

func UnixMilli(msec int64) Time

func (Time) Add

func (Time) Add(d Duration) Time

func (Time) AddDate

func (Time) AddDate(years int, months int, days int) Time

func (Time) AppendBinary

func (Time) AppendBinary(b []byte) ([]byte, error)

func (Time) AppendFormat

func (Time) AppendFormat(b []byte, layout string) []byte

func (Time) AppendText

func (Time) AppendText(b []byte) ([]byte, error)

func (Time) Clock

func (Time) Clock() (hour int, min int, sec int)

func (Time) Compare

func (Time) Compare(u Time) int

func (Time) Date

func (Time) Date() (year int, month Month, day int)

func (Time) Day

func (Time) Day() int

func (Time) GoString

func (Time) GoString() string

func (Time) GobEncode

func (Time) GobEncode() ([]byte, error)

func (Time) Hour

func (Time) Hour() int

func (Time) ISOWeek

func (Time) ISOWeek() (year int, week int)

func (Time) In

func (Time) In(loc *Location) Time

func (Time) IsDST

func (Time) IsDST() bool

func (Time) Local

func (Time) Local() Time

func (Time) Location

func (Time) Location() *Location

func (Time) MarshalBinary

func (Time) MarshalBinary() ([]byte, error)

func (Time) MarshalJSON

func (Time) MarshalJSON() ([]byte, error)

func (Time) MarshalText

func (Time) MarshalText() ([]byte, error)

func (Time) Minute

func (Time) Minute() int

func (Time) Month

func (Time) Month() Month

func (Time) Nanosecond

func (Time) Nanosecond() int

func (Time) Round

func (Time) Round(d Duration) Time

func (Time) Second

func (Time) Second() int

func (Time) String

func (Time) String() string

func (Time) Sub

func (Time) Sub(u Time) Duration

func (Time) Truncate

func (Time) Truncate(d Duration) Time

func (Time) UTC

func (Time) UTC() Time

func (Time) Weekday

func (Time) Weekday() Weekday

func (Time) Year

func (Time) Year() int

func (Time) YearDay

func (Time) YearDay() int

func (Time) Zone

func (Time) Zone() (name string, offset int)

func (Time) ZoneBounds

func (Time) ZoneBounds() (start Time, end Time)

type Weekday

type Weekday int
const Friday Weekday = 5
const Monday Weekday = 1
const Saturday Weekday = 6
const Sunday Weekday = 0
const Thursday Weekday = 4
const Tuesday Weekday = 2
const Wednesday Weekday = 3

func (Weekday) String

func (Weekday) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL