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

藏色散人
Release: 2020-10-22 17:08:13
forward
2011 people have browsed it

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")
Copy after login

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!

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