Skip to main content

Notifications

Power Automate - General Discussion
Unanswered

Changing Date Format not applying to some records

(0) ShareShare
ReportReport
Posted on by

I have flow that gets a data from dataverse and puts in into a CSV table to be sent as attachment in email and for saving in One Drive. The issue is I'm changing the DateFormat of one of the columns into the CSV table but after running the flow some of the records are properly formatted into what I put in the expression and some have different formats applied to them. 

 

Power Automate 1.JPG

 

Here's how I used the CSV Table

 

Power Automate 2.JPG

 

And this is how it looks like when the file is generated in one drive and the file attached to the email. 

 

Power Automate 3.JPG

  • RazenC Profile Picture
    RazenC on at
    Re: Changing Date Format not applying to some records

    Hi Emad,

    I've created this file also via flow with .csv extension file name using CREATE FILE action from One Drive business. I'll try changing it to xlsx extension to see how it goes. But I need that feature in PowerApps where they can export with csv or xlsx option so if it's messing up in CSV that will cause an issue on my side.

  • EmadBeshai Profile Picture
    EmadBeshai 806 on at
    Re: Changing Date Format not applying to some records

    Hi @RazenC ,

     

    I think this is excel file, if it is an excel file please fix the format from the excel template itself not the power automate flow.

     

    If this post helps you with your problem, please mark this answer as Accepted Solution.
    If you like my response, please give it a Thumbs Up.

  • RazenC Profile Picture
    RazenC on at
    Re: Changing Date Format not applying to some records

    Sorry. Got lost on this one. I still get the part about switching the MM and mm but do you mean the problem is in the records itself based on how it is formatted? 

     

    I tried removing the HH:mm:ss in the date format with these remaining

    formatDateTime(item()?['cr21b_requirementcreatedate'], 'yyyy-MM-dd')

    but still the results is giving me these formats

    RazenC_0-1698322831370.png

    I'm really lost. 

  • wskinnermctc Profile Picture
    wskinnermctc 6,512 on at
    Re: Changing Date Format not applying to some records

    The first example you showed from the initial post had the Minutes in the Months place. 

     

    MM=months

    mm=minutes

     

    Your first example:

    formatDateTime(item()?['cr21b_requirementcreatedate'], 'yyyy-mm-dd HH:MMss')

     

    Notice the MM and mm are switched around.

     

    When this ran through power automate and the CSV - it recognized this as text for most of the datetimes since none of them were actual date times (example 2020-55-21 is not a date). However, some of them did make an actual date time, so the CSV converted it into date format.

     

  • RazenC Profile Picture
    RazenC on at
    Re: Changing Date Format not applying to some records

    Hi, Thanks for looking into this. But unfortunately it doesn't solve the issue. 

    After applying the format you've suggested

    formatDateTime(item()?['cr21b_requirementcreatedate'], 'yyyy-MM-dd HH:mm:ss')

    There are no records that are not updated or have different format but the results became this.

     

    Result 1.JPG

     

    Just for additional info. I tried removing the date format and it looks like this. 

    Result 3.JPG

     

    This is how it looks like in Dataverse.

     

    Result 2.JPG

     

    Actually I'm also putting this in a HTML table to be sent in an email. But it doesn't cause any issues

     

    Result 4.JPGResult 5.JPG

     

    Really confused why this works and not in CSV table. 

  • Re: Changing Date Format not applying to some records

    Hi, @RazenC 

    According to your screenshot , you are using the formatDateTime() function to get the format of the date.\

    You can try to use the 'yyyy-MM-dd HH:mm:ss'  to test .

    For more information, you can refer to :
    Custom date and time format strings - .NET | Microsoft Learn

    I test it in my side , it works good where the column in my dataverse columnn type is "DateTime":

    vyueyunmsft_0-1698212768997.png

    The result is as follows:

    vyueyunmsft_1-1698212816439.png

     

     

    Second, you can check that the date format you have the problem with is the same as the date format returned correctly. You can check this in the output in above action.

    You can compare the difference between the correct and incorrect values in the results returned in the previous step.

     

    If this still doesn't help you solve the problem, you can provide me with some format data in Dataverse that has problems, along with your expected output, so that I can better help you.

     

    Best Regards,

    Yueyun Zhang

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard