mirror of
https://github.com/rulego/gflow-engine.git
synced 2026-12-05 08:00:59 +00:00
22 lines
487 B
Go
22 lines
487 B
Go
package utils
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/rulego/gflow-engine/types/constants"
|
|
)
|
|
|
|
// FormatTime 按引擎统一的时间格式化(constants.TimeFormatLayout)。
|
|
func FormatTime(tm time.Time) string {
|
|
return tm.Format(constants.TimeFormatLayout)
|
|
}
|
|
|
|
// FormatTimePtr 格式化时间指针;nil 返回 nil(用于可空时间字段的 DTO 装配)。
|
|
func FormatTimePtr(tm *time.Time) *string {
|
|
if tm == nil {
|
|
return nil
|
|
}
|
|
formatted := FormatTime(*tm)
|
|
return &formatted
|
|
}
|