Giter VIP home page Giter VIP logo

gotime's Introduction

gotime

用golang写的一个time的工具集合(A time util for golang)

#Install

go get github.com/andyidea/gotime

#Function

获取时间戳

func GetTimeUnix(t time.Time) int64 

获取当前时间的时间戳

func GetNowTimeUnix() int64

获取当日晚上24点(次日0点)的时间

func Get24time(t time.Time) time.Time 

获取当日晚上24点(次日0点)的时间戳

func Get24timeUnix(t time.Time) int64

获取今天晚上24点(次日0点)的时间戳

func GetToday24timeUnix() int64

时间转换成日期字符串 (time.Time to "2006-01-02")

func TimeToDate(t time.Time) string

获取当前的日期字符串

func GetNowDateStr() string

时间转换成日期+时间字符串 (time.Time to "2006-01-02 15:04:05")

func TimeToDateTime(t time.Time) string

获取当前的时期+时间字符串

func GetNowStr() string

日期字符串转换成时间 ("2006-01-02" to time.Time)

func DateStrToTime(d string) time.Time

日期+时间字符串转换成时间 ("2006-01-02 15:04:05" to time.Time)

func DateTimeStrToTime(dt string) time.Time

gotime's People

Contributors

andyidea avatar

Watchers

James Cloos avatar looo3ooo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.