alexboe

New Member
Joined
Dec 22, 2017
Messages
4
Hi,

I'm trying to import a csv file with dates formatted like: Jan 1, 2017 6:01:12 AM PST

How do I transform those dates when importing in PowerBI (and powerpivot)?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
https://community.powerbi.com/t5/Desktop/Date-string/m-p/328336#M146582

Code:
let
    Source = "Jan 1, 2017 6:01:12 AM PST",
    #"Converted to Table" = #table(1, {{Source}}),
    #"Extracted Text Before Delimiter" = Table.TransformColumns(#"Converted to Table", {{"Column1", each Text.BeforeDelimiter(_, " PST", 0), type text}}),
    #"Parsed Date" = Table.TransformColumns(#"Extracted Text Before Delimiter",{{"Column1", each Date.From(DateTimeZone.From(_)), type date}})
in
    #"Parsed Date"
 
Upvote 0
Hi,

Thanks for the quick response. It doesn't seem to work (token eof expected). Could you explain what this code tried to do? You first take all the text before PST and then try to transform into a date with time? How about the Jan in it? I don't think it understands its the first month as its formatted as text. Also I don't need the time stamp. Just the date.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,603
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top