go-carbon1.3.3 version released

藏色散人
Release: 2021-02-23 15:28:20
forward
2263 people have browsed it

The following is the tutorial column of golang to introduce the go-carbon1.3.3 version to you. New methods for obtaining constellations and determining whether it is a certain constellation are added. Hope it helps those in need!

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 If you think it’s good, please give it a star

github:github.com/golang-module/carbon

gitee:gitee.com/go-package/carbon

Update log
  • Add new Constellation() method to obtain constellation, support multi-language
  • Add new IsXXX() series method to determine whether it is a certain constellation
  • Newly added ToMonthString() method outputs the complete month string, supports multiple languages ​​
  • Newly added ToShortMonthString() method outputs abbreviated month string, supports multiple languages
  • Newly added ToWeekString() method Output the complete week string, support multi-language
  • Add the ToShortWeekString() method to output the abbreviated week string, support multi-language
  • Fix the BUG of repeated HeavenlyStems variable values ​​in the calendar.go file
// 获取星座
carbon.Parse("2020-08-05 13:14:15").Constellation() // Leo
carbon.Parse("2020-08-05 13:14:15").SetLocale("zh-CN").Constellation() // 狮子座

// 是否是白羊座
carbon.Parse("2020-08-05 13:14:15").IsAries() // false
// 是否是金牛座
carbon.Parse("2020-08-05 13:14:15").IsTaurus() // false
// 是否是双子座
carbon.Parse("2020-08-05 13:14:15").IsGemini() // false
// 是否是巨蟹座
carbon.Parse("2020-08-05 13:14:15").IsCancer() // false
// 是否是狮子座
carbon.Parse("2020-08-05 13:14:15").IsLeo() // true
// 是否是处女座
carbon.Parse("2020-08-05 13:14:15").IsVirgo() // false
// 是否是天秤座
carbon.Parse("2020-08-05 13:14:15").IsLibra() // false
// 是否是天蝎座
carbon.Parse("2020-08-05 13:14:15").IsScorpio() // false
// 是否是射手座
carbon.Parse("2020-08-05 13:14:15").IsSagittarius() // false
// 是否是摩羯座
carbon.Parse("2020-08-05 13:14:15").IsCapricorn() // false
// 是否是水瓶座
carbon.Parse("2020-08-05 13:14:15").IsAquarius() // false
// 是否是双鱼座
carbon.Parse("2020-08-05 13:14:15").IsPisces() // false

// 输出完整月份字符串
carbon.Parse("2020-08-05 13:14:15").ToMonthString() // August
carbon.Parse("2020-08-05 13:14:15").SetLocale("en").ToMonthString() // August
carbon.Parse("2020-08-05 13:14:15").SetLocale("zh-CN").ToMonthString() // 八月

// 输出缩写月份字符串
carbon.Parse("2020-08-05 13:14:15").ToShortMonthString() // Aug
carbon.Parse("2020-08-05 13:14:15").SetLocale("en").ToShortMonthString() // Aug
carbon.Parse("2020-08-05 13:14:15").SetLocale("zh-CN").ToShortMonthString() // 8月

// 输出完整星期字符串
carbon.Parse("2020-08-05 13:14:15").ToWeekString() // Tuesday
carbon.Parse("2020-08-05 13:14:15").SetLocale("en").ToWeekString() // Tuesday
carbon.Parse("2020-08-05 13:14:15").SetLocale("zh-CN").ToWeekString() // 星期二

// 输出缩写星期字符串
carbon.Parse("2020-08-05 13:14:15").ToShortWeekString() // Tue
carbon.Parse("2020-08-05 13:14:15").SetLocale("en").ToShortWeekString() // Tue
carbon.Parse("2020-08-05 13:14:15").SetLocale("zh-CN").ToShortWeekString() // 周二
Copy after login

The above is the detailed content of go-carbon1.3.3 version released. 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