代码拉取完成,页面将自动刷新
同步操作将从 dromara/carbon 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package carbon_test
import (
"fmt"
"gitee.com/golang-package/carbon/v2"
)
func ExampleZeroValue() {
fmt.Println(carbon.ZeroValue().ToString())
// Output:
// 0001-01-01 00:00:00 +0000 UTC
}
func ExampleEpochValue() {
fmt.Println(carbon.EpochValue().ToString())
// Output:
// 1970-01-01 00:00:00 +0000 UTC
}
func ExampleMaxValue() {
fmt.Println(carbon.MaxValue().ToString())
// Output:
// 9999-12-31 23:59:59.999999999 +0000 UTC
}
func ExampleMinValue() {
fmt.Println(carbon.MinValue().ToString())
// Output:
// 0001-01-01 00:00:00 +0000 UTC
}
func ExampleMaxDuration() {
fmt.Println(carbon.MaxDuration().Seconds())
// Output:
// 9.223372036854776e+09
}
func ExampleMinDuration() {
fmt.Println(carbon.MinDuration().Seconds())
// Output:
// -9.223372036854776e+09
}
func ExampleMax() {
c1 := carbon.Parse("2020-08-01")
c2 := carbon.Parse("2020-08-05")
c3 := carbon.Parse("2020-08-06")
fmt.Println(carbon.Max(c1, c2, c3).ToString())
// Output:
// 2020-08-06 00:00:00 +0000 UTC
}
func ExampleMin() {
c1 := carbon.Parse("2020-08-01")
c2 := carbon.Parse("2020-08-05")
c3 := carbon.Parse("2020-08-06")
fmt.Println(carbon.Min(c1, c2, c3).ToString())
// Output:
// 2020-08-01 00:00:00 +0000 UTC
}
func ExampleCarbon_Closest() {
c1 := carbon.Parse("2020-08-01")
c2 := carbon.Parse("2020-08-05")
c3 := carbon.Parse("2020-08-06")
fmt.Println(c1.Closest(c2, c3).ToString())
fmt.Println(c2.Closest(c1, c3).ToString())
fmt.Println(c3.Closest(c2, c1).ToString())
// Output:
// 2020-08-05 00:00:00 +0000 UTC
// 2020-08-06 00:00:00 +0000 UTC
// 2020-08-05 00:00:00 +0000 UTC
}
func ExampleCarbon_Farthest() {
c1 := carbon.Parse("2020-08-01")
c2 := carbon.Parse("2020-08-05")
c3 := carbon.Parse("2020-08-06")
fmt.Println(c1.Farthest(c2, c3).ToString())
fmt.Println(c2.Farthest(c1, c3).ToString())
fmt.Println(c3.Farthest(c1, c2).ToString())
// Output:
// 2020-08-06 00:00:00 +0000 UTC
// 2020-08-01 00:00:00 +0000 UTC
// 2020-08-01 00:00:00 +0000 UTC
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。