Skip to content

Commit aff8726

Browse files
author
wuzhijian
committed
fix date
1 parent 61cf77d commit aff8726

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

php.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ func Time() int64 {
2222
return time.Now().Unix()
2323
}
2424

25-
func Date(format ...string, timestamp int64) string {
25+
func Date(format string, timestamp int64) string {
2626
if len(format) > 0 {
27-
return time.Unix(timestamp, 0).Format(format[0])
27+
return time.Unix(timestamp, 0).Format(format)
2828
}
2929

3030
return time.Unix(timestamp, 0).Format(GO_TIME_LAYOUT)

php_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func TestTime(t *testing.T) {
1212

1313
func TestDate(t *testing.T) {
1414
tt := Time()
15-
dd := Date(tt)
15+
dd := Date("2006#01#02", tt)
1616
t.Log(dd)
1717
}
1818

0 commit comments

Comments
 (0)