MCPcopy
hub / github.com/duke-git/lancet / ExampleAddHour

Function ExampleAddHour

datetime/datetime_example_test.go:51–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49}
50
51func ExampleAddHour() {
52 date, _ := time.Parse("2006-01-02 15:04:05", "2021-01-01 00:00:00")
53
54 after2Hours := AddHour(date, 2)
55 before2Hours := AddHour(date, -2)
56
57 fmt.Println(after2Hours.Format("2006-01-02 15:04:05"))
58 fmt.Println(before2Hours.Format("2006-01-02 15:04:05"))
59
60 // Output:
61 // 2021-01-01 02:00:00
62 // 2020-12-31 22:00:00
63}
64
65func ExampleAddMinute() {
66 date, _ := time.Parse("2006-01-02 15:04:05", "2021-01-01 00:00:00")

Callers

nothing calls this directly

Calls 2

AddHourFunction · 0.85
FormatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…