New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple date format support #603
Labels
Comments
Yes! It should be fairly easy to do I think. |
Since TypeConverterOption is used for output and input how would it know which one to use when outputting CSV files? It would seem to implement this properly it would require some refactoring or a custom converter. |
You can just check for dashes in your string and then choose which format
string to pass to datetime.parse.l in your converter.
…On Jan 22, 2017 12:26 PM, "Scott White" ***@***.***> wrote:
Since TypeConverterOption is used for output and input how would it know
which one to use when outputting CSV files? It would seem to implement this
properly it would require some refactoring or a custom converter.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#603 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AD_ohY4hcn3IfXz47kIzo1uQN_xISMunks5rU5FRgaJpZM4Kr6h2>
.
|
fyi in the meantime I have found it handy to use a simple extension method for this...
use it in a class map like this...
|
Just committed this. e8d56c7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to allow for more than a single date format for parsing dates when reading files. Dates can be in either yyyy-MM-dd or yyyyMMdd formats.
My initial attempt was to use TypeConverterOption and set multiple options, which didn't work (I assume that only the last format is used).
.TypeConverterOption("yyyy-MM-dd").TypeConverterOption("yyyyMMdd")
The DateTime class has a ParseExact overload which accepts an array of format strings, is there a way to incorporate that into the default DateTimeConverter class?
The text was updated successfully, but these errors were encountered: