datetime

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 2 Imported by: 2

Documentation

Overview

Package datetime contains methods and structs to deal with ISO8601 encoded UTC datetime

Index

Constants

View Source
const ISO8601 = "2006-01-02T15:04:05-0700"

ISO8601 is a time.Time layout for the ISO8601 format

Variables

This section is empty.

Functions

This section is empty.

Types

type DateTime

type DateTime struct {
	time.Time
}

DateTime represents a time.Time that uses ISO8601 for json input/output instead of RFC3339

func Now

func Now() *DateTime

Now returns the current UTC time.

func (*DateTime) AddDate

func (t *DateTime) AddDate(years, months, days int) *DateTime

AddDate returns the time corresponding to adding the given number of years, months, and days to t.

func (*DateTime) Equal

func (t *DateTime) Equal(u *DateTime) bool

Equal check if the given date is equal to the current one

func (DateTime) MarshalJSON

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

MarshalJSON returns a valid json representation of the struct https://golang.org/pkg/encoding/json/#Marshaler

func (*DateTime) Scan

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

Scan assigns a value from a database driver https://golang.org/pkg/database/sql/#Scanner

func (*DateTime) UnmarshalJSON

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

UnmarshalJSON tries to parse a json data into a valid struct https://golang.org/pkg/encoding/json/#Unmarshaler

func (*DateTime) Value

func (t *DateTime) Value() (driver.Value, error)

Value returns a value that the database can handle https://golang.org/pkg/database/sql/driver/#Valuer

Jump to

Keyboard shortcuts

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