feat:update template

This commit is contained in:
zhangwenjian
2020-07-25 14:59:30 +08:00
parent 485110f214
commit caab6097b8
2 changed files with 12 additions and 5 deletions
+6
View File
@@ -29,6 +29,12 @@ func GetCurrentTime() time.Time {
return time.Now()
}
func FormatTimeStr(timeStr string) (string, error) {
loc, _ := time.LoadLocation("Local")
theTime, err := time.ParseInLocation("2006-01-02T15:04:05.000Z", timeStr, loc)
return theTime.Format("2006/01/02 15:04:05"), err
}
func StructToJsonStr(e interface{}) (string, error) {
if b, err := json.Marshal(e); err == nil {
return string(b), err