20 lines
515 B
Go
20 lines
515 B
Go
|
package format
|
||
|
|
||
|
import (
|
||
|
"math"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
TimeFormat = "2006-01-02T15:04:05.999999Z07:00"
|
||
|
)
|
||
|
|
||
|
// FormatedTime returns a current timestamp without nano seconds. Postgres
|
||
|
// currently does not support nanoseconds which is automatically include into
|
||
|
// the go time object
|
||
|
func FormatedTime() time.Time {
|
||
|
t := time.Now()
|
||
|
l, _ := time.LoadLocation("Europe/Berlin")
|
||
|
return time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), int(math.Round(float64(t.Nanosecond())/1000000)*1000000), l)
|
||
|
}
|