Reputation: 67
I am trying to convert a column in a csv file that contains the following datetime format.
12 mar 2016 10:27:47 fm
But when I change type to DateTime I get this error:
Error: Could not parse the input provided to a DateTime value
I have tried converting using different locale as well with no success.
How can I convert it to a correct datetime format?
Upvotes: 0
Views: 4927
Reputation: 6999
Our date/time parser for locales like Swedish where you'd use "fm" for "am" only allows 24-hour time. Sorry that you ran into this!
Alejandro's fix would look like:
DateTime.FromText(Text.Replace(Text.Replace("12 mar 2016 10:27:47 fm", " fm", " am"), " em", " pm"))
Upvotes: 1
Reputation: 4144
Should the fm on that line be am or pm?
You can work around it by replacing fm in the text with am or pm using Text.Replace
and then using that text in DateTime.FromText
.
Upvotes: 1