You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
345 B

package date
import (
"errors"
"time"
)
func (dateTime *DateTime) parseWithFormat(str string, location *time.Location) (t time.Time, err error) {
for _, format := range TimeFormats {
t, err = time.ParseInLocation(format, str, location)
if err == nil {
return
}
}
err = errors.New("Can't parse string as time: " + str)
return
}