Home > Backend Development > Golang > 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!

藏色散人
Release: 2021-01-19 15:47:46
forward
2247 people have browsed it

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")
Copy after login
carbon and time.Time conversion
// Go 内置 Time.time 转 Carbon
carbon.CreateFromGoTime(time.Now())
// Carbon 转 Go 内置 Time.time
carbon.Now().ToGoTime()
Copy after login

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!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template