24 lines
578 B
Go
24 lines
578 B
Go
package format
|
|
|
|
import (
|
|
"errors"
|
|
"math"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
errorPraseTime = errors.New("Can not parse time")
|
|
|
|
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)
|
|
|
|
}
|