fa-sdk-go/pkg/furaffinaty/utils/date.go

17 lines
288 B
Go
Raw Normal View History

package utils
import (
"errors"
"time"
)
const inputFormat = "Jan 2, 2006 03:04 PM"
func ParseDate(input string) (time.Time, error) {
t, err := time.Parse(inputFormat, input)
if err != nil {
return time.Time{}, errors.New("Cannot parse time: " + err.Error())
}
return t, nil
}