tmu

package
v1.0.26 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GeneralLayouts = []string{time.RFC3339, "2006-1-2 15:04:05", "2006-1-2", "15:04:05"}

Functions

func Atod added in v1.0.17

func Atod(s string, defs ...time.Duration) time.Duration

Atod convert string to time.Duration. if not found or convert error, returns the defs[0] or zero.

func Parse added in v1.0.26

func Parse(value string, layouts ...string) (tt time.Time, err error)

func ParseInLocation added in v1.0.26

func ParseInLocation(value string, loc *time.Location, layouts ...string) (tt time.Time, err error)

func TruncateHours added in v1.0.26

func TruncateHours(t time.Time) time.Time

TruncateHours tuncate hours for time t. Returns the time (local: yyyy-MM-dd 00:00:00).

func TruncateMinutes added in v1.0.26

func TruncateMinutes(t time.Time) time.Time

TruncateMinutes tuncate minute for time t. Returns the time (yyyy-MM-dd hh:00:00).

func TruncateSeconds added in v1.0.26

func TruncateSeconds(t time.Time) time.Time

TruncateSeconds tuncate second for time t. Returns the time (yyyy-MM-dd hh:mm:00).

Types

type HHMM

type HHMM int

HHMM HH:MM (Minutes)

func ParseHHMM

func ParseHHMM(s string) (HHMM, error)

func (HHMM) MarshalJSON

func (hm HHMM) MarshalJSON() ([]byte, error)

func (HHMM) Minutes

func (hm HHMM) Minutes() int

func (HHMM) String

func (hm HHMM) String() string

func (*HHMM) UnmarshalJSON

func (hm *HHMM) UnmarshalJSON(data []byte) (err error)

type MMSS

type MMSS int

MMSS MM:SS (Seconds)

func ParseMMSS

func ParseMMSS(s string) (MMSS, error)

func (MMSS) MarshalJSON

func (ms MMSS) MarshalJSON() ([]byte, error)

func (MMSS) Seconds

func (ms MMSS) Seconds() int

func (MMSS) String

func (ms MMSS) String() string

func (*MMSS) UnmarshalJSON

func (ms *MMSS) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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