17 lines
288 B
Go
17 lines
288 B
Go
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
|
|
}
|