()
| 49 | } |
| 50 | |
| 51 | func 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 | |
| 65 | func ExampleAddMinute() { |
| 66 | date, _ := time.Parse("2006-01-02 15:04:05", "2021-01-01 00:00:00") |