If I have date format: "1/_2/2006, 15:04:05"
How to I convert the entire date to seconds. Is there a golang time method?
If I have date format: "1/_2/2006, 15:04:05"
How to I convert the entire date to seconds. Is there a golang time method?
There's a nice little package on GitHub to abstract the format matching part of Parse
(it requires you provide a string to explain the format of your date); https://github.com/araddon/dateparse
You can just use ParseAny
to get a time.Time{}
call it ts
then ts.Unix
to get seconds. I would recommend it since Parse
itself is extremely sensitive to it's input.