dtime

package
v0.0.0-...-236a94d Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2018 License: MIT Imports: 3 Imported by: 2

Documentation

Overview

Package dtime 工具包 时间辅助操作

Index

Constants

View Source
const (
	ShortTimeLayout  = "2006-01-02"
	MiddleTimeLayout = "2006-01-02 15:04"
	LongTimeLayout   = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func ParseTime

func ParseTime(layout, v string) time.Time

ParseTime 解析时间

Types

type JSONMiddleTime

type JSONMiddleTime struct{ JSONTime }

JSONMiddleTime 展示年月日时分,e.g. 2017-11-01 14:23

func (*JSONMiddleTime) FromDB

func (t *JSONMiddleTime) FromDB(b []byte) error

func (JSONMiddleTime) MarshalJSON

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

MarshalJSON outputs JSON presentation

func (JSONMiddleTime) String

func (t JSONMiddleTime) String() string

func (JSONMiddleTime) ToDB

func (t JSONMiddleTime) ToDB() interface{}

func (*JSONMiddleTime) UnmarshalJSON

func (t *JSONMiddleTime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal string to JSONTime

type JSONShortTime

type JSONShortTime struct{ JSONTime }

JSONShortTime 只展示年月日 e.g. 2017--11-01

func (*JSONShortTime) FromDB

func (t *JSONShortTime) FromDB(b []byte) error

func (JSONShortTime) MarshalJSON

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

MarshalJSON outputs JSON presentation

func (JSONShortTime) String

func (t JSONShortTime) String() string

func (JSONShortTime) ToDB

func (t JSONShortTime) ToDB() interface{}

func (*JSONShortTime) UnmarshalJSON

func (t *JSONShortTime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal string to JSONTime

type JSONTime

type JSONTime int64

JSONTime JSON 时间, 时间戳

func Now

func Now() JSONTime

func ParseJSONTime

func ParseJSONTime(layout, v string) JSONTime

ParseJSONTime 解析时间戳

func Today

func Today() JSONTime

func (JSONTime) Add

func (t JSONTime) Add(d time.Duration) JSONTime

func (JSONTime) AsMiddleTime

func (t JSONTime) AsMiddleTime() JSONMiddleTime

AsMiddleTime 转换为中长日期格式

func (JSONTime) AsShortTime

func (t JSONTime) AsShortTime() JSONShortTime

AsShortTime 转换为短日期格式

func (JSONTime) Format

func (t JSONTime) Format(layout string) string

func (JSONTime) IsZero

func (t JSONTime) IsZero() bool

IsZero 是否为零值

func (JSONTime) MarshalJSON

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

MarshalJSON outputs JSON presentation

func (JSONTime) String

func (t JSONTime) String() string

func (JSONTime) Time

func (t JSONTime) Time() time.Time

func (*JSONTime) UnmarshalJSON

func (t *JSONTime) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal string to JSONTime

Jump to

Keyboard shortcuts

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