I'm trying to convert a string which is actually a date with the format such as Sep 10 2005 12:03:34:716 PM to a datetime without losing any characters in the string.
I've been trying to use the detect data type and modify data type functions in the Power Query Editor but each of the results cause all values to change into Errors. I am using the correct Locale.
I also tried adding a custom column with the following formula which also results in error values:
= DateTime.FromText(Text.Start([MyTextColumnNameGoesHere],27), [Format="MMM dd yyyy HH:mm:ss:000 tt"])
Can anyone lend me a hand in resolving this? I've been at it for hours.
Kind Regards,
Updated, this the formula I used:
DateTime.FromText([Column8], [Format="MMM dd yyyy HH:mm:ss:fff tt"])
Advanced Editor:
let
Source = Csv.Document(File.Contents("D:\Users\rubhi\Downloads\access_control_t.bcp"),[Delimiter="#(tab)", Columns=10, Encoding=20127, QuoteStyle=QuoteStyle.None]),
#"Replaced Value" = Table.ReplaceValue(Source,"P"," P",Replacer.ReplaceText,{"Column8"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","A"," A",Replacer.ReplaceText,{"Column8"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1"," Au","Au",Replacer.ReplaceText,{"Column8"}),
#"Changed Type with Locale1" = Table.TransformColumnTypes(#"Replaced Value2", {{"Column8", type text}}, "en-US"),
#"Added Custom" = Table.AddColumn(#"Changed Type with Locale1", "Custom.8", each DateTime.FromText([Column8], [Format="MMM dd yyyy HH:mm:ss:fff tt"]))
in
#"Added Custom"