Files
olons_server/internal/store/time.go
T
richjohnrambo 8ce67648b1
Deploy olons-server production / deploy (push) Successful in 3m12s
feat: add global system notices and Beijing order time display
2026-10-22 21:56:07 +08:00

9 lines
430 B
Go

package store
// databaseWallTimeUTC normalizes DATETIME values written by CURRENT_TIMESTAMP.
// The database session can use UTC or Beijing time independently of the Go process.
// Do not use it for fields explicitly written as UTC by application code.
func databaseWallTimeUTC(column string) string {
return `DATE_FORMAT(TIMESTAMPADD(SECOND,TIMESTAMPDIFF(SECOND,NOW(),UTC_TIMESTAMP()),` + column + `),'%Y-%m-%dT%H:%i:%sZ')`
}