parent
1c100c7659
commit
e8c0ff31b3
|
@ -1086,13 +1086,13 @@ func (engine *Engine) TZTime(t time.Time) (r time.Time) {
|
|||
return
|
||||
}
|
||||
|
||||
func (engine *Engine) NowTime(SQLTypeName string) interface{} {
|
||||
func (engine *Engine) NowTime(sqlTypeName string) interface{} {
|
||||
t := time.Now()
|
||||
return engine.FormatTime(SQLTypeName, t)
|
||||
return engine.FormatTime(sqlTypeName, t)
|
||||
}
|
||||
|
||||
func (engine *Engine) FormatTime(SQLTypeName string, t time.Time) (v interface{}) {
|
||||
switch SQLTypeName {
|
||||
func (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{}) {
|
||||
switch sqlTypeName {
|
||||
case Time:
|
||||
s := engine.TZTime(t).Format("2006-01-02 15:04:05") //time.RFC3339
|
||||
v = s[11:19]
|
||||
|
|
|
@ -1964,7 +1964,7 @@ func (session *Session) byte2Time(col *Column, data []byte) (outTime time.Time,
|
|||
outErr = errors.New(fmt.Sprintf("unsupported time format %v: %v", sdata, err))
|
||||
return
|
||||
}
|
||||
outTime = x
|
||||
outTime = session.Engine.TZTime(x)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2403,7 +2403,7 @@ func (session *Session) value2Interface(col *Column, fieldValue reflect.Value) (
|
|||
}
|
||||
switch fieldValue.Interface().(type) {
|
||||
case time.Time:
|
||||
tf := session.Engine.FormatTime(col.SQLType.Name,fieldValue.Interface().(time.Time))
|
||||
tf := session.Engine.FormatTime(col.SQLType.Name, fieldValue.Interface().(time.Time))
|
||||
return tf, nil
|
||||
default:
|
||||
return fieldValue.Interface(), nil
|
||||
|
|
Loading…
Reference in New Issue