vtime

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDayOfNow

func AddDayOfNow(day int) time.Time

func AddDayOfNowUtc

func AddDayOfNowUtc(day int) time.Time

func AddDayUtc

func AddDayUtc(t time.Time, day int) time.Time

func GetEpochTime

func GetEpochTime() time.Time

func GetEpochTimeUtc

func GetEpochTimeUtc() time.Time

func GetNextMonthFirstDay

func GetNextMonthFirstDay(t time.Time) time.Time

func GetNextMonthFirstDayNow

func GetNextMonthFirstDayNow() time.Time

func GetNextMonthFirstDayNowUtc

func GetNextMonthFirstDayNowUtc() time.Time

func GetNextMonthFirstDayNowUtcUnix

func GetNextMonthFirstDayNowUtcUnix() int64

func GetNow

func GetNow() time.Time

func GetNowUtc

func GetNowUtc() time.Time

func GetNowUtcUnix

func GetNowUtcUnix() int64

func GetSecondsFromNowToNextMonthFirstDay

func GetSecondsFromNowToNextMonthFirstDay() int64

func GetSecondsFromNowToNextMonthFirstDayDuration

func GetSecondsFromNowToNextMonthFirstDayDuration() time.Duration

func New

func New(param ...any) *gtime.Time

New creates and returns a Time object with given parameter. The optional parameter can be type of: time.Time/*time.Time, string or integer.

func Now

func Now() *gtime.Time

Now creates and returns a time object of now.

func StrToTime

func StrToTime(str string, format ...string) (*gtime.Time, error)

StrToTime converts string to *Time object. It also supports timestamp string. The parameter `format` is unnecessary, which specifies the format for converting like "Y-m-d H:i:s". If `format` is given, it acts as same as function StrToTimeFormat. If `format` is not given, it converts string as a "standard" datetime string. Note that, it fails and returns error if there's no date string in `str`.

func Timestamp

func Timestamp() int64

Timestamp retrieves and returns the timestamp in seconds.

func TimestampMilli

func TimestampMilli() int64

TimestampMilli retrieves and returns the timestamp in milliseconds.

Types

type UtcTime

type UtcTime time.Time

func (UtcTime) MarshalJSON

func (t UtcTime) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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