Skip to content

Commit

Permalink
fix date
Browse files Browse the repository at this point in the history
  • Loading branch information
wuzhijian committed Jul 16, 2019
1 parent 61cf77d commit aff8726
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions php.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func Time() int64 {
return time.Now().Unix()
}

func Date(format ...string, timestamp int64) string {
func Date(format string, timestamp int64) string {
if len(format) > 0 {
return time.Unix(timestamp, 0).Format(format[0])
return time.Unix(timestamp, 0).Format(format)
}

return time.Unix(timestamp, 0).Format(GO_TIME_LAYOUT)
Expand Down
2 changes: 1 addition & 1 deletion php_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestTime(t *testing.T) {

func TestDate(t *testing.T) {
tt := Time()
dd := Date(tt)
dd := Date("2006#01#02", tt)
t.Log(dd)
}

Expand Down

0 comments on commit aff8726

Please sign in to comment.