27 lines
437 B
Go
27 lines
437 B
Go
/*
|
|
* @FileName: time_test.go
|
|
* @Author: JJXu
|
|
* @CreateTime: 2022/2/25 下午2:37
|
|
* @Description:
|
|
*/
|
|
|
|
package stime
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestTime(t *testing.T) {
|
|
result := NowTimeToTime(Format_Normal_YMDhms)
|
|
fmt.Println(result)
|
|
}
|
|
func TestGetAge(t *testing.T) {
|
|
age := GetAge(time.Date(1991, 3, 6, 0, 0, 0, 0, Loc.Shanghai()))
|
|
fmt.Println(age)
|
|
if age != 31 {
|
|
t.Errorf("want 31 but get %v", age)
|
|
}
|
|
}
|