dateparse
dateparse copied to clipboard
Can dateparse return the formatters used?
Hi! New to open-source here, so not sure if this is the best place to ask a question about your project. Let me know if i need to direct my question elsewhere.
After parsing a date string, is it possible to return the formatters used for parsing? For example, I have a large file of dates all the same unknown format. It would probably be much faster to parse the first date, figure out what formatter it's using and apply that to subsequent dates through time.Parse.
I asked this same question about python's dateutil.parser but learned that what I was aksing is impossible from the base package. https://stackoverflow.com/questions/49197938/return-directives-used-by-dateutil-parser. We could follow the guidance from this answer: https://stackoverflow.com/a/49198112/6146337 to implement.
What do you think?
https://godoc.org/github.com/araddon/dateparse#ParseFormat You can call ParseFormat, store the resulting string, and use it with time.Parse thereafter