joda-time项目的go语言实现

abelli5 · · 1365 次点击
补充了日期字段的 add/with 等方法: ·// add year/month/... and return copy of the instance ·// 增加年月日等字段的值,并返回新实例 ·jt := jodatime.DateHour(2024, 1, 8, 6).AddYear(5).AddMonth(3).AddDay(-6).AddHour(7) ·// set with-year/month/... and return copy of the instance ·// 设置日期字段并返回新实例 ·jt = jodatime.DateFull(2021, 3, 4, 5, 6, 7, 8).WithYear(2020).WithMonth(2).WithDay(3).WithHour(4).WithMinute(5).WithSecond(6).WithNanosecond(0) **体会** 闰年、闰月略微复杂些,感觉还有待优化。暂不支持闰秒,这个功能再考虑下~
#1
更多评论
gouguoyin
Let's golang
可以试试 https://github.com/golang-module/carbon
#2