Documentation ¶
Index ¶
- Constants
- func GetLangTimeFormat(lang string) string
- func GetTimeFormat(lang string) string
- func MinutesToFriendly(minutes int, lang string) string
- func RawTimeSince(t time.Time, lang string) string
- func TimeSince(then time.Time, lang string) template.HTML
- func TimeSincePro(then time.Time, lang string) string
- func TimeSinceUnix(then TimeStamp, lang string) template.HTML
- type TimeStamp
- func (ts TimeStamp) Add(seconds int64) TimeStamp
- func (ts TimeStamp) AddDuration(interval time.Duration) TimeStamp
- func (ts TimeStamp) AsTime() (tm time.Time)
- func (ts TimeStamp) AsTimeInLocation(loc *time.Location) (tm time.Time)
- func (ts TimeStamp) AsTimePtr() *time.Time
- func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time
- func (ts TimeStamp) Format(f string) string
- func (ts TimeStamp) FormatInLocation(f string, loc *time.Location) string
- func (ts TimeStamp) FormatLong() string
- func (ts TimeStamp) FormatShort() string
- func (ts TimeStamp) IsZero() bool
- func (ts TimeStamp) Year() int
Constants ¶
const ( Minute = 60 Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month )
Seconds-based time units
Variables ¶
This section is empty.
Functions ¶
func GetLangTimeFormat ¶
GetLangTimeFormat represents the default time format for the language
func MinutesToFriendly ¶
MinutesToFriendly returns a user friendly string with number of minutes converted to hours and minutes.
func RawTimeSince ¶
RawTimeSince retrieves i18n key of time since t
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
Types ¶
type TimeStamp ¶
type TimeStamp int64
TimeStamp defines a timestamp
func (TimeStamp) AddDuration ¶
AddDuration adds time.Duration and return sum
func (TimeStamp) AsTimeInLocation ¶
AsTimeInLocation convert timestamp as time.Time in Local locale
func (TimeStamp) AsTimePtrInLocation ¶
AsTimePtrInLocation convert timestamp as *time.Time in customize location
func (TimeStamp) FormatInLocation ¶
FormatInLocation formats timestamp as given format with spiecific location
func (TimeStamp) FormatLong ¶
FormatLong formats as RFC1123Z
func (TimeStamp) FormatShort ¶
FormatShort formats as short