time

package module
v0.0.0-...-86c5cad Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go 时间类型

    type Time time.Time
  • 实现了json UnmarshalJSON MarshalJSON 接口,
  • 主要是 UnmarshalJSON 在时间解析时可以支持多种格式的解析,
  • 解析空字符串 "" 会初始化一个时间类型而不是得到一个 " parsing time """" as ""2006-01-02T15:04:05Z07:00"": cannot parse """ as "2006" "
  • 实现了database/sql 的 Value Scan 接口。便于数据库操作

Documentation

Index

Constants

View Source
const DatabaseTimeFormat = "2006-01-02 15:04:05"

Variables

This section is empty.

Functions

This section is empty.

Types

type Time

type Time time.Time

func (Time) MarshalJSON

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

func (Time) Scan

func (t Time) Scan(src interface{}) error

Scan implements the sql.Scanner interface

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

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

func (Time) Value

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

Value 和 Scan 方法用于数据库操作

Jump to

Keyboard shortcuts

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