Kansas City PowerApps and Flow User Group

Please login or click SIGN UP FOR FREE to create your PowerPlatformUG account to join this user group.
Expand all | Collapse all

Microsoft Flow Converting Time from UTC

  • 1.  Microsoft Flow Converting Time from UTC

    Bronze Contributor
    Posted Jan 25, 2019 02:26 PM
    Hi All,

    Looking for a little assistance. I'm trying to convert our 'Date_completed' string from UTC to local time zone and in the format of 'YYYY-MM-DD'

    Here's what I'm trying to convert.

    Trying to take the pre-defined 'Date Completed' item inside 'Get_a_specific_audit' step, then trying to convert it with the format above.

    I tried the following in the output of excel, however I get an invalid expressions. 
    formatDateTime(body('Get_a_specific_audit')?['audit_data']?['date_completed']),'YYYY-MM-DD')​
    
    formatDateTime(body('Get_a_specific_audit')?['audit_data']?['date_completed'],'YYYY-MM-DD')​


    Any help you all can provide, would be greatly appreciated. 



    ------------------------------
    Joshua Yeamans
    Product Specialist
    Kansas City MO
    9135751209
    ------------------------------


  • 2.  RE: Microsoft Flow Converting Time from UTC

    Posted Jan 28, 2019 12:34 PM
    Hi Joshua -

    This can be performed easily in the scope of your flow. You will need to use the 'Convert Time Zone' action, it should take place before the action that sends data to Excel. Instead of using your "Date_Completed" variable, use the "Converted Time" for writing that data to Excel.

    I have initialized a variable to represent the Date Completed dynamic content from your screenshot:

    Result:
    result
    Hope this helps you get it sorted out! Feel free to reach out if you have any problems.

    ------------------------------
    Griffin Gaeth
    Application Developer
    Blue Cross Blue Shield of Kansas City
    Kansas City MO

    ------------------------------



  • 3.  RE: Microsoft Flow Converting Time from UTC

    Bronze Contributor
    Posted Jan 31, 2019 08:54 AM
    @Griffin Gaeth Thank you for your feedback. I've used that Action previously, it does work well. I was looking to see if you or anyone else knew of the actual expression needed to place inside output in Excel, rather than adding additional steps within the flow itself.

    If not, my work around is to use formulas in the table to convert the timezone for reporting purposes. ​

    ------------------------------
    Joshua Yeamans
    Product Specialist
    Kansas City MO
    9135751209
    ------------------------------



  • 4.  RE: Microsoft Flow Converting Time from UTC

    Posted Jan 31, 2019 10:54 AM
    Edited by Griffin Gaeth Jan 31, 2019 11:05 AM
    @Joshua Yeamans ​ Sorry, I'm not very well versed in Excel expressions or formulas. Found this on SO: https://stackoverflow.com/questions/36456115/excel-how-to-convert-utc-date-time

    Is there a reason you are trying to separate this action from the flow? One added step in flow shouldn't decrease your run speeds... if that's what you are worried about.

    ------------------------------
    Griffin Gaeth
    Application Developer
    Blue Cross Blue Shield of Kansas City
    Kansas City MO
    ------------------------------



  • 5.  RE: Microsoft Flow Converting Time from UTC

    Bronze Contributor
    Posted Jan 31, 2019 11:06 AM
    @Griffin Gaeth Thanks for your response. Yes, you're correct, adding a few of these don't slow it down too much, however I was looking to parse out the date, the time and convert them for each date/time field presented.

    This would increase the flow by six actions (convert UTC to local time zone, then display as YYYY-MM-DD and HH:MM:SS) for the following
    • Date Created
    • Date Completed
    • Date Modified
    • Time Created
    • Time Completed 
    • Time Modified

    This is why on output, I was wanting to write a single expression for each of the above instead of adding additional steps to convert.

    I hope this makes sense.


    ------------------------------
    Joshua Yeamans
    Product Specialist
    Kansas City MO
    9135751209
    ------------------------------