Documentation ¶
Overview ¶
Package dtime 工具包 时间辅助操作
Index ¶
- Constants
- func ParseTime(layout, v string) time.Time
- type JSONMiddleTime
- type JSONShortTime
- type JSONTime
- func (t JSONTime) Add(d time.Duration) JSONTime
- func (t JSONTime) AsMiddleTime() JSONMiddleTime
- func (t JSONTime) AsShortTime() JSONShortTime
- func (t JSONTime) Format(layout string) string
- func (t JSONTime) IsZero() bool
- func (t JSONTime) MarshalJSON() ([]byte, error)
- func (t JSONTime) String() string
- func (t JSONTime) Time() time.Time
- func (t *JSONTime) UnmarshalJSON(b []byte) error
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 ¶
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 (JSONTime) AsMiddleTime ¶
func (t JSONTime) AsMiddleTime() JSONMiddleTime
AsMiddleTime 转换为中长日期格式
func (JSONTime) MarshalJSON ¶
MarshalJSON outputs JSON presentation
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON unmarshal string to JSONTime
Click to show internal directories.
Click to hide internal directories.