timex

package
v0.0.0-...-e0aa601 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Iso3339CleanTime

func Iso3339CleanTime(t time.Time) string

Iso3339CleanTime converts the given time to ISO 3339 format

func LastDayOfMonth

func LastDayOfMonth(dateInMonth time.Time) int

LastDayOfMonth returns the last day of the month of the given date.

Types

type Time

type Time struct {
	time.Time
}

Time is just like time.Time, except it maintains UTC and marshals to second precision only

Use .Time to access the underlying time.Time.

func NewTime

func NewTime(t time.Time) Time

NewTime creates a Time instance from a time.Time instance (standardized to UTC).

func NewTimeFromString

func NewTimeFromString(s string) (Time, error)

NewTimeFromString parses a Time instance from a string using RFC 3339 parsing.

func Now

func Now() Time

Now returns the current time (standardized to UTC)

func (Time) MarshalJSON

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

MarshalJSON serializes a Time instance as the underlying time.Time instance.

func (Time) RFC3339Format

func (t Time) RFC3339Format() string

RFC3339Format returns the RFC 3339 string representation of the time, set at UTC (terminated in a Z), in the resolution of milliseconds

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements deserialization for database/sql

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes a Time instance from the JSON string representation.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements serialization for database/sql

Jump to

Keyboard shortcuts

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