fox/xtime/parser_test.go
2025-05-25 20:02:15 +08:00

17 lines
368 B
Go

package xtime
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParse(t *testing.T) {
assert.Equal(t, Parse("2023-01-01 00:00:00").ToDateTimeString(), "2022-12-31 20:00:00")
}
func TestFromMilli(t *testing.T) {
ts := int64(1672502400000) // "2023-01-01 00:00:00"
assert.Equal(t, FromUnixMilli(ts).ToDateTimeString(), "2022-12-31 20:00:00")
}