- append " 00:00:00" form pure date in Time2Str.
This commit is contained in:
@@ -215,6 +215,9 @@ func Time2Str(t time.Time) string {
|
||||
|
||||
func Str2Time(timeStr string) time.Time {
|
||||
timeStr = strings.Replace(timeStr, "T", " ", 1)
|
||||
if strings.Index(timeStr, " ") == -1 {
|
||||
timeStr += " 00:00:00"
|
||||
}
|
||||
retVal, err := time.ParseInLocation("2006-01-02 15:04:05", timeStr, time.Local)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("time.ParseInLocation failed, timeStr:%v, error:%v", timeStr, err)
|
||||
|
||||
Reference in New Issue
Block a user