Search code examples
powerbidaxpowerquerypowerbi-desktopm

Timezone name (like PDT) in date field


I am having trouble with converting a date in PowerBI like:

Column name date:

2022-06-25 05:23:15 PDT

First off, after importing this file into my PowerBI project, the column above is marked as text. If I try to change this column type to Date/Time/Timezone in the query editor the result in an error:

= Table.AddColumn(#"Promoted Headers", "NewDate", each DateTimeZone.FromText([date]))

DataFormat.Error: We couldn't parse the input provided as a DateTimeZone value.
Details:
    2022-06-25 05:23:15 PDT

Is the use of a Timezone name a bad thing in PowerBI? All examples I search for use a UTC offset but the date I have is so common, it seems ridiculous to have to change the data to a UTC offset.


Solution

  • You have to do a conversion I'm afraid. Something like the following I think for PDT.

    = Table.AddColumn(Source, "Custom", each DateTime.AddZone( DateTime.FromText([Column1], [Format = "yyyy-MM-dd hh:mm:ss"]), -7))