1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-11 23:46:39 +08:00
Files
kubo/util/time.go
Brian Tiger Chow f1ee23770d feat(util/time) impl RFC3339Nano UTC utility Format/Parse functions
test(time)
expose time format var

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
2014-11-16 02:45:20 -08:00

18 lines
310 B
Go

package util
import "time"
var TimeFormatIpfs = time.RFC3339Nano
func ParseRFC3339(s string) (time.Time, error) {
t, err := time.Parse(TimeFormatIpfs, s)
if err != nil {
return time.Time{}, err
}
return t.UTC(), nil
}
func FormatRFC3339(t time.Time) string {
return t.UTC().Format(TimeFormatIpfs)
}