Home  >  Article  >  Backend Development  >  go-carbon version 1.2.5 is released, adding two new mutual conversion methods!

go-carbon version 1.2.5 is released, adding two new mutual conversion methods!

藏色散人
藏色散人forward
2021-01-19 15:47:462211browse

The following is the tutorial column of golang to introduce to you the release of go-carbon1.2.5 version, which has a new carbon and time.Time mutual conversion method. I hope it will be useful to friends who need it. Helped!

go-carbon version 1.2.5 is released, adding two new mutual conversion methods!

go-carbon version 1.2.5 is released, with new carbon and time.Time mutual conversion methods

carbon is a lightweight, semantic, and easy-to-use tool for developers Friendly Golang time processing library, supports chain calls, lunar calendar and mainstream ORMs such as gorm and xorm

If you think it is good, please give it a star

github:github.com/golang- module/carbon

gitee:gitee.com/go-package/carbon

Installation and use

// 使用github库
go get -u github.com/golang-module/carbon

import (
 "github.com/golang-module/carbon")

// 使用gitee库
go get -u gitee.com/go-package/carbon

import (
 "gitee.com/go-package/carbon")
carbon and time.Time conversion
// Go 内置 Time.time 转 Carbon
carbon.CreateFromGoTime(time.Now())
// Carbon 转 Go 内置 Time.time
carbon.Now().ToGoTime()

Update log

  • Update readme.md document
  • Fix known errors
  • Rename const.go to constant .go
  • Add a new CreateFromGoTime() method to convert time.Time to a carbon instance
  • Add a new ToGoTime() method to convert a carbon instance to time.Time

For more golang related technical articles, please visit the go language column!

The above is the detailed content of go-carbon version 1.2.5 is released, adding two new mutual conversion methods!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:learnku.com. If there is any infringement, please contact admin@php.cn delete