-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgotime_test.go
57 lines (55 loc) · 1.02 KB
/
gotime_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package gotime
import (
"fmt"
"testing"
"time"
)
func TestGoTime_Now(t *testing.T) {
tm := Now()
fmt.Println(tm)
}
func TestGoTime_Before(t *testing.T) {
tm := Before(3600)
fmt.Println(tm)
}
func TestGoTime_Next(t *testing.T) {
tm := Next(3600)
fmt.Println(tm)
}
func TestGoTime_GetYmd(t *testing.T) {
tm := Ymd()
fmt.Println(tm)
}
func TestGoTime_NowTime(t *testing.T) {
tm := NowTime()
fmt.Println(tm)
}
func TestGoTime_RfcToUnix(t *testing.T) {
tm := RfcToUnix("2018-12-12T15:28:16+08:00")
fmt.Println(tm)
}
func TestGoTime_GetRFC3339(t *testing.T) {
tm := GetRFC3339()
fmt.Println(tm)
}
func TestGoTime_ToRFC3339(t *testing.T) {
tm := ToRFC3339(Now())
fmt.Println(tm)
}
func TestGoTime_GetFormat(t *testing.T) {
tm := GetFormat("YYYYMM")
fmt.Println(tm)
}
//自定义时间
func TestSelf(t *testing.T) {
loc, err := time.LoadLocation("America/Cordoba")
loc, err = time.LoadLocation("Asia/Chongqing")
if err != nil {
panic(err)
}
g := GoTime{
Location:loc,
}
fmt.Println(g.Now())
fmt.Println(g.GetRFC3339())
}