Home >Backend Development >Golang >Look! go-carbon version 1.2.2 is released! Added time setting and time difference comparison functions

Look! go-carbon version 1.2.2 is released! Added time setting and time difference comparison functions

藏色散人
藏色散人forward
2020-10-22 16:55:101980browse

The following column golang tutorial will introduce to you the release of go-carbon 1.2.2 version, which adds time setting and time difference comparison functions. I hope it will be helpful to friends who need it. Helps!

Look! go-carbon version 1.2.2 is released! Added time setting and time difference comparison functions

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

  • New SetYear() method to set the year
  • New SetMonth() method Set the month
  • Add a new SetDay() method to set the day
  • Add a new SetHour() method to set the time
  • Add a new SetMinute() method to set the minute
  • Added SetSecond method to set seconds
  • Added DiffInWeeks() method to calculate the number of weeks difference
  • Added new DiffAbsInWeeks() method to calculate the number of weeks difference (absolute value)
  • Added DiffInDays() method to calculate the difference in days
  • Added DiffAbsInDays() method to calculate the difference in days (absolute value)
  • Added DiffInHours() method to calculate the difference in hours
  • Added DiffAbsInHours() method to calculate the difference in hours (absolute value)
  • Added DiffInMinutes() method to calculate the difference in minutes
  • Added DiffAbsInMinutes() method to calculate the difference in minutes (absolute value)
  • Added DiffInSeconds() method to calculate how many seconds the difference is
  • Added new DiffAbsInSeconds() method to calculate how many seconds the difference is (absolute value)

The above is the detailed content of Look! go-carbon version 1.2.2 is released! Added time setting and time difference comparison functions. 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