Home >Backend Development >Golang >go-carbon1.2.4 is released! Added series time comparison method

go-carbon1.2.4 is released! Added series time comparison method

藏色散人
藏色散人forward
2020-11-06 15:01:532501browse

The following column golang tutorial will introduce to you about the go-carbon 1.2.4 version release, a new series of time comparison methods, I hope it will be helpful to friends who need it help!

go-carbon1.2.4 is released! Added series time comparison method

carbon is a lightweight, semantic, developer-friendly Golang time processing library that 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")

Update log

  • Deprecate the Duration() method and split it For AddDuration() and SubDuration()
  • Added Compare() method to compare time
  • Added Gt() method to determine whether it is greater than
  • Added Lt() method to determine Whether it is less than
  • New Eq() method to determine whether it is equal
  • New Ne() method to determine whether it is not equal
  • New Gte() method to determine whether it is greater than or equal
  • Added Lte() method to determine whether it is less than or equal to
  • Added Between() method to determine whether it is between two times (excluding these two times)
  • New Added BetweenIncludedStartTime() method to determine whether it is between two times (including the start time)
  • Added BetweenIncludedEndTime() method to determine whether it is between two times (including the end time)
  • New Added BetweenIncludedBoth() method to determine whether it is between two times (including these two times)

The above is the detailed content of go-carbon1.2.4 is released! Added series time comparison method. 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