cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yashaikh
Frequent Visitor

Power Automate Microsoft Flow does not retrieve correct UTC 00 value of Date Only field or does not convert to correct time zone value

I am having an issue in MS Flow while retrieving the value of expirydate field of type Date Only from a custom entity. My Time zone in personalized settings is UTC +12 (New Zealand Standard Time)

 

  1. On the UI of model driven app, I had entered the following value and the app still correctly show expirydate field value:

expirydate (Date Only) = 30/6/2021 (this field has behaviour set to User Local)

 

  1. By exporting custom entity record in excel from make.powerapps.com, I can see the following values:

created on (Date Time) = 2021-05-01T10:25:20Z         (this I mentioned to let you know when the record was actually created)

expirydate (Date Only) = 2021-06-29T12:00:00Z  (this seems to be correct in UTC 00 as for Date Only fields time part is dropped and hence it first changes from 2021-06-30T10:25:20Z to 2021-06-30T00:00:00Z, then while storing it in Dataverse it is converted to UTC 00, therefore it changes from 2021-06-30T00:00:00Z to 2021-06-29T12:00:00Z which is exactly a 12 hours difference. 

 

  1. when I retrieve the record using microsoft flow, instead of getting the Dataverse stored UTC 00 value 2021-06-29T12:00:00Z, I am getting following:

 

expirydate (Date Only) = 2021-06-29T00:00:00.0000000Z (missing time portion of 12 hours)

 

Therefore when I convert 2021-06-29T00:00:00.0000000Z to UTC +12 using convertTimeZone function, the date remains 29 and doesn't change back to 30 because 2021-06-29T00:00:00.0000000Z does not contain  offset portion of 12 hours which I had retrieved by exporting it in Excel in step 2.

 

I have tried following as well but nothing works:

 

convertTimeZone(concat(triggerBody()?['expirydate'],'Z'),'UTC','New Zealand Standard Time','yyyy-MM-ddTHH:mm:ss.fffffffZ')

 

convertFromUtc(formatDateTime(triggerBody()?['expirydate'],'yyyy-MM-ddTHH:mm:ss.fffffffZ'),'New Zealand Standard Time','F')

 

convertFromUtc(concat(triggerBody()?['expirydate'],'Z'),'New Zealand Standard Time','F')

 

 

All I need is to successfully convert the expirydate into correct UTC +12 value which is 2021-06-30T00:00:00Z and thats only possible when I will retrieve correct UTC 00 value 2021-06-29T12:00:00Z of expirydate field in Microsoft Flow. 

 

Anyone can please let me know how I can achieve this?

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
yashaikh
Frequent Visitor

OK, I have found the solution for this problem with a hit and trial logic. Actually this is a Microsoft bug in Power Automate. What happens is for Date Only fields having behavior set  to User Local doesn't retrieve the time component stored in Dataverse when the Microsoft Flow triggers.

 

In my above scenario, MS Flow fetches 6/29 instead of 6/29 12:00 PM when the flow triggers on "when a reocrd is updated" , which is why convertTimeZone function is not able to convert 6/29 to 6/30. The way around for this problem is to fetch the same record using Dataverse component "Get a Row" in Microsoft Flow, this time it will bring time component of all Date Only fields having behavior set to User Local. Once you get the time component , you are good to go using convertTimeZone function to convert the value in respective zone.

 

 

Following is the behavior when the flow triggers, I had used the 13 May on UI but it returns 12 May without time component:

yashaikh_2-1620871310020.png

 

And when I fetch the same record again, it returns the time component, i.e. 12 May 12:00 PM

 

yashaikh_3-1620871472692.png

 

 

Regards,

 

 

 

View solution in original post

13 REPLIES 13
Pstork1
Most Valuable Professional
Most Valuable Professional

Just to be clear.  2021-06-29T12:00:00Z  is a date only field that has already been adjusted for New Zealand Time zone.  A Date only field in actual UTC would be 2021-06-29T00:00:00Z  12:00:00Z is noon in UTC.  00:00:00Z is midnight.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

If 2021-06-29T12:00:00Z is already adjusted to New Zealand Time Zone, then why it is adjusted again as 30/6/2021 on the UI of model driven app. Therefore I believe 2021-06-29T12:00:00Z is not in New Zealand Time Zone, rather a UTC 00 value

yashaikh
Frequent Visitor

@rrovira , @Mari , @ajdhingr , or anyone else,  can you please look into my query?

Pstork1
Most Valuable Professional
Most Valuable Professional

As I said, 00:00:00Z is midnight UTC.  12:00:00Z is noon.  New Zealand time Zone is +12 UTC.  So Midnight in UTC is noon in New Zealand.  YOu said in the UI of the Model driven app it was set to User.local by the UI.  So when the user enters the time it is automatically translated from user.local to UTC.  That's why you are seeing the value stored as 12:00:00Z.  The 12:00:00Z is in UTC the same time as midnight in user.local.  When you read the value in Power Automate it is reading the UTC value as stored and is not adjusting back to user.local.  Since User.local in New Zealand is UTC+12 you need to add 12 to the 12:00:00Z which should result in 00:00:00Z + one day.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 I do know and understand 00:00:00Z is midnight UTC and 12:00:00Z is noon, and I have already tried adding 12 in what is read by Power Automate. The Power Automate Flow currently reads 2021-06-29T00:00:00.0000000Z and adding 12 converts it in 2021-06-29T12:00:00.0000000Z but not 2021-06-30T00:00:00.0000000Z, and my point is Power Automate should read the value 2021-06-29T12:00:00.0000000Z from Dataverse in first place, then only when 12 is added,  it will change to 2021-06-30T00:00:00.0000000Z. Let me know if I am still thinking wrong.

 

My second point is, why do I require to add 12 manually ? I was expecting this from converTimeZone function or from converFromUTc function.

Pstork1
Most Valuable Professional
Most Valuable Professional

Is the column in Dataverse defined as a date only column?  If it is then its dropping the time portion of the date when it is saved.  So here is what I think is happening.

1) User inputs 6/30 midnight local time.

2) The UI converts that to 6/29 noon UTC and stores in in Dataverse

3) Dataverse truncates it and stores 6/29 midnight since its a date only column.

4) Flow retrieves the date only column 6/29 midnight.

 

There are also settings in the Dataverse column that control what it stores.  Verify what your settings are on that column.  Here's an excerpt from the documentation.

Behavior and format of the Date and Time column in Microsoft Dataverse - Power Apps | Microsoft Docs

Date and time column behavior and format

The following table contains information about the date and time column behavior and format.

DATE AND TIME COLUMN BEHAVIOR AND FORMAT
Behavior Format Description
User Local Date Only
- or -
Date and Time
This is the default behavior of custom date and time columns.

The column values are displayed in the current user's local time.
In Web services, these values are returned using a common UTC time zone format.

You can change this one time if you select the default behavior. More information Change User Local Behavior
Date Only Date Only No Time zone conversion.

The time portion of the value is always 12:00AM.
The date portion of the value is stored and retrieved as specified in the UI and Web services.
Time-Zone Independent Date Only
- or -
Date and Time
No Time zone conversion.

The date and time values are stored and retrieved as specified in the UI and Web services.


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

In point 4 you said "Flow retrieves the date only column 6/29 midnight." , if that is true then why Excel Data is showing 2021-06-29T12:00:00.0000000Z which is the correct representation of Dataverse. I am claiming this as correct representation of Dataverse because UI is able to successfully convert this value into 2021-06-30T00:00:00.0000000Z by adding +12 using whatever logic, be it a convertTimeZone function or convertFromUTc function. As explained already in my first post, let me reiterate what is happening which I believe:

 

1.  As a user I provided value 6/30 on UI (we can assume it with current time or without current time i.e. 2021-06-30T10:25:20.0000000Z OR 2021-06-30T00:00:00.0000000Z, but time portion will be dropped.)

2. The logic lying between UI and Dataverse drops the time portion of 6/30 and converts it from UTC New Zealand to UTC only, i.e. 2021-06-30T00:00:00.0000000Z is converted to 2021-06-29T12:00:00.0000000Z

3. As a final step 2021-06-29T12:00:00.0000000Z is stored in Dataverse.

 

If you still convinced that Dataverse is storing 2021-06-29T00:00:00.0000000Z instead of 2021-06-29T12:00:00.0000000Z, then are you trying to say that when UI displays back the value to user, it is adding 1 full day to convert it back to UTC New Zealand? If yes, then that is not I am convinced with because on what basis the logic is trying to add 1 full day, since the difference between the UTC and UTC New Zelanad is only 12 hours.

 

 

Secondly I had asked a question, why do I manually need to adjust hours to convert the value in local time zone? why can't I use convertTimeZon function or convertFromUTc function?

Pstork1
Most Valuable Professional
Most Valuable Professional

Excel and Dataverse handle Date and Time differently.  Did you check the behavior settings on the column to compare it to the chart I posted from the documentation?  I believe the key here is #3 in the list where Dataverse is truncating the Date and Time to Date Only.  That effectively changes the local time of Noon on 6/29 to Midnight on 6/29.  When you convert it back it converts back to Noon on 6/29 not Midnight on 6/30.  For most time zones it would be clearer, but since New Zealand is exactly 1/2 day off it becomes less clear what is happening.  Please check the Behavior settings on the column and compare those to the chart I posted.

 

The key is in your #1.  The User.local to UTC Time zone conversion is taking place BEFORE the time portion is dropped.  So when it comes out and the TimeZone is converted back its the wrong day.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

If dataverse has stored 6/29 midnight, then by what logic UI is able to successfully convert it to 6/30? Unless it adds 24 hours, it won't change to 6/30 and this is why I am not convinced UI would be adding exactly 24 hours because there is no reason of doing hard coded logic instead of time zone conversion logic, and hence it tempts me to believe dataverse is storing 6/29 noon.

 

 

The behaviour of expirydate field I had already mentioned in the first post i.e. User Local. 

Pstork1
Most Valuable Professional
Most Valuable Professional

But that's exactly your problem.  Because the field is being truncated to Date Only when its stored there is no way to get it back to 6/30 using a Time zone shift.

 

Did you check the Behavior settings on the column and compare those to the chart I posted.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
yashaikh
Frequent Visitor

When I hard code to add 1 day in 6/29 (exiprydate), it successfully converts the value to New Zealand Standard Time. After that when I change the Time Zone to USA and create a new records, the logic of adding 1 day in expirydate fails and converts the value 1 day ahead, i.e. 31/29

 

Behaviour settings i already explained that it is set as User Local and Format is set to Date Only. I cannot use other settings for my specific requirement.

 

yashaikh
Frequent Visitor

OK, I have found the solution for this problem with a hit and trial logic. Actually this is a Microsoft bug in Power Automate. What happens is for Date Only fields having behavior set  to User Local doesn't retrieve the time component stored in Dataverse when the Microsoft Flow triggers.

 

In my above scenario, MS Flow fetches 6/29 instead of 6/29 12:00 PM when the flow triggers on "when a reocrd is updated" , which is why convertTimeZone function is not able to convert 6/29 to 6/30. The way around for this problem is to fetch the same record using Dataverse component "Get a Row" in Microsoft Flow, this time it will bring time component of all Date Only fields having behavior set to User Local. Once you get the time component , you are good to go using convertTimeZone function to convert the value in respective zone.

 

 

Following is the behavior when the flow triggers, I had used the 13 May on UI but it returns 12 May without time component:

yashaikh_2-1620871310020.png

 

And when I fetch the same record again, it returns the time component, i.e. 12 May 12:00 PM

 

yashaikh_3-1620871472692.png

 

 

Regards,

 

 

 

yashaikh
Frequent Visitor

Helpful resources

Announcements

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Tuesday Tips: Community Ranks and YOU

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!This Week: Community Ranks--Moving from "Member" to "Community Champion"   Have you ever wondered how your fellow community members ascend the ranks within our community? What sets apart an Advocate from a Helper, or a Solution Sage from a Community Champion? In today’s #TuesdayTip, we’re unveiling the secrets and sharing tips to help YOU elevate your ranking—and why it matters to our vibrant communities. Community ranks serve as a window into a member’s role and activity. They celebrate your accomplishments and reveal whether someone has been actively contributing and assisting others. For instance, a Super User is someone who has been exceptionally helpful and engaged. Some ranks even come with special permissions, especially those related to community management. As you actively participate—whether by creating new topics, providing solutions, or earning kudos—your rank can climb. Each time you achieve a new rank, you’ll receive an email notification. Look out for the icon and rank name displayed next to your username—it’s a badge of honor! Fun fact: Your Community Engagement Team keeps an eye on these ranks, recognizing the most passionate and active community members. So shine brightly with valuable content, and you might just earn well-deserved recognition! Where can you see someone’s rank? When viewing a post, you’ll find a member’s rank to the left of their name.Click on a username to explore their profile, where their rank is prominently displayed. What about the ranks themselves? New members start as New Members, progressing to Regular Visitors, and then Frequent Visitors.Beyond that, we have a categorized system: Kudo Ranks: Earned through kudos (teal icons).Post Ranks: Based on your posts (purple icons).Solution Ranks: Reflecting your solutions (green icons).Combo Ranks: These orange icons combine kudos, solutions, and posts. The top ranks have unique names, making your journey even more exciting! So dive in, collect those kudos, share solutions, and let’s see how high you can rank!  🌟 🚀   Check out the Using the Community boards in each of the communities for more helpful information!  Power Apps, Power Automate, Copilot Studio & Power Pages

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

Users online (3,670)