gitea: code.gitea.io/gitea/modules/timeutil Index | Files

package timeutil

import "code.gitea.io/gitea/modules/timeutil"

Index

Package Files

language.go since.go timestamp.go

Constants

const (
    Minute = 60
    Hour   = 60 * Minute
    Day    = 24 * Hour
    Week   = 7 * Day
    Month  = 30 * Day
    Year   = 12 * Month
)

Seconds-based time units

func GetLangTimeFormat Uses

func GetLangTimeFormat(lang string) string

GetLangTimeFormat represents the default time format for the language

func GetTimeFormat Uses

func GetTimeFormat(lang string) string

GetTimeFormat represents the

func MinutesToFriendly Uses

func MinutesToFriendly(minutes int, lang string) string

MinutesToFriendly returns a user friendly string with number of minutes converted to hours and minutes.

func RawTimeSince Uses

func RawTimeSince(t time.Time, lang string) string

RawTimeSince retrieves i18n key of time since t

func TimeSince Uses

func TimeSince(then time.Time, lang string) template.HTML

TimeSince calculates the time interval and generate user-friendly string.

func TimeSincePro Uses

func TimeSincePro(then time.Time, lang string) string

TimeSincePro calculates the time interval and generate full user-friendly string.

func TimeSinceUnix Uses

func TimeSinceUnix(then TimeStamp, lang string) template.HTML

TimeSinceUnix calculates the time interval and generate user-friendly string.

type TimeStamp Uses

type TimeStamp int64

TimeStamp defines a timestamp

func TimeStampNow Uses

func TimeStampNow() TimeStamp

TimeStampNow returns now int64

func (TimeStamp) Add Uses

func (ts TimeStamp) Add(seconds int64) TimeStamp

Add adds seconds and return sum

func (TimeStamp) AddDuration Uses

func (ts TimeStamp) AddDuration(interval time.Duration) TimeStamp

AddDuration adds time.Duration and return sum

func (TimeStamp) AsTime Uses

func (ts TimeStamp) AsTime() (tm time.Time)

AsTime convert timestamp as time.Time in Local locale

func (TimeStamp) AsTimeInLocation Uses

func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time)

AsTimeInLocation convert timestamp as time.Time in Local locale

func (TimeStamp) AsTimePtr Uses

func (ts TimeStamp) AsTimePtr() *time.Time

AsTimePtr convert timestamp as *time.Time in Local locale

func (TimeStamp) AsTimePtrInLocation Uses

func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time

AsTimePtrInLocation convert timestamp as *time.Time in customize location

func (TimeStamp) Format Uses

func (ts TimeStamp) Format(f string) string

Format formats timestamp as given format

func (TimeStamp) FormatInLocation Uses

func (ts TimeStamp) FormatInLocation(f string, loc *time.Location) string

FormatInLocation formats timestamp as given format with spiecific location

func (TimeStamp) FormatLong Uses

func (ts TimeStamp) FormatLong() string

FormatLong formats as RFC1123Z

func (TimeStamp) FormatShort Uses

func (ts TimeStamp) FormatShort() string

FormatShort formats as short

func (TimeStamp) IsZero Uses

func (ts TimeStamp) IsZero() bool

IsZero is zero time

func (TimeStamp) Year Uses

func (ts TimeStamp) Year() int

Year returns the time's year

Package timeutil imports 6 packages (graph) and is imported by 26 packages. Updated 2019-09-19. Refresh now. Tools for package owners.