Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Convert Date Column from UTC to EST Timezone

Hi, 

 

I'm pulling CRM dynamics data in UTC format, I see that dates showing in Powerbi is different from CRM dynamics. Now i want to convert that date column to local time zone EST. 

 

Please share me in Power Query how to convert this Date column from UTC to EST time zone

 

Here is the sample data looks like -

 

 

 

 

 

 

 

 

 

Thanks,

Santosh

  • Hi  Anonymous ,

     

    UTC is 5 hrs ahead of EST,so create below M query to convert the timezone column to EST time:

    EST = DateTimeZone.SwitchZone([UTC],-5)

    And you will see:

    For the sample .pbix file,pls see attached.

     

     

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

5 Replies

  • Jimmy801's avatar
    Jimmy801
    Community Champion

    Hello Anonymous 

     

    you can use the function DateTimeZone.SwitchZone. Here an example

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjTXMzTUMzIwMlAwMLACIwVtMKUUqwOUNsQtHQsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Created_Date = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Created_Date", type datetimezone}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "EST", each DateTimeZone.SwitchZone([Created_Date], 5), type datetimezone)
    in
        #"Added Custom"

     

    Copy paste this code to the advanced editor in a new blank query to see how the solution works.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy

     

  • v-kelly-msft's avatar
    v-kelly-msft
    Community Support

    Hi  Anonymous ,

     

    UTC is 5 hrs ahead of EST,so create below M query to convert the timezone column to EST time:

    EST = DateTimeZone.SwitchZone([UTC],-5)

    And you will see:

    For the sample .pbix file,pls see attached.

     

     

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!

    • JacoMathew's avatar
      JacoMathew
      Frequent Visitor

      Hi,

       

      how does the function take care when the day light savings kicks in ? Is there a function that looks at the date and decides whether it should be -5 or -4 (Eastern Daylight Time) ?

       

      Thanks

      Jaco

  • lmyers's avatar
    lmyers
    Frequent Visitor

    I'm using the powerbi template - CQ and AA analytics combined analytics. The call queue analysis table has time in UTC. How do I add a column, conversion to conver this to EST? When filtering on the measure Calls volumne for a day, the time is in UTC which is not helpful for our staff when they are looking at what time calls are coming in.

     

    I'm very new to powerbi and would like some assistance how I can add a column to this table to convert the Date column to a Date column in EST.

     

    I've tried to follow these suggestions but not sure how to apply this to the template.