站点更新:2018-01-23 15:49:21

This commit is contained in:
2018-01-23 15:49:21 +08:00
parent e130e7ef07
commit 4e4db08282
8 changed files with 2 additions and 1 deletions

24
utils/date/formater.go Normal file
View File

@@ -0,0 +1,24 @@
package date
import (
"fmt"
)
const (
YYYYMMDDHHmmSS = "2006-01-02 15:04:05"
)
func Formater(formater string) string {
r := ""
for _, v := range formater {
s := fmt.Sprintf("%c", v)
switch s {
case "y", "Y":
r += s
case "-", " ":
r += s
}
}
return r
}

View File

@@ -0,0 +1,11 @@
package date
import (
"testing"
"github.com/ehlxr/go-utils/log"
)
func TestDateFormater(t *testing.T) {
log.Infof("now tims is %s", Formater("yyyy-MM-dd HH:mm:ss"))
}