Skip to main content
Community site session details

Community site session details

Session Id : fB5jJ8D7lyWvBa71EJ8Gm8
Power Automate - Building Flows
Answered

ParseDateTime Blanks? Issue with IF statement

Like (0) ShareShare
ReportReport
Posted on 6 Jun 2022 23:16:51 by

Hello!

 

I can't seem to wrap my head around this, I feel like I'm ignoring something but I can't figure out what exactly.

I have a flow that creates an HTML table based on certain fields in an Excel file. I'm having issues with the format of the dates when there are blanks. I'm using an IF statement that leaves the field as null if the value is null, if it's not then format the date but always returns an error if there's a blank. 

 

Please note that I'm using ISO 8601 as the DateTime format. 

Data:

MikeMurillo_0-1654556518909.png  

Create HTML Table step:

MikeMurillo_2-1654556766040.png

 

Formula (I have tried several options, however none of them work):

1.

if(empty(formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy')), null, formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'))

 

2.

if(equals(formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'), null), null, formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'))
 
3.

if(equals(formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'), ''), null, formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'))

 

This is the error that I get when the data has a blank:

MikeMurillo_3-1654556988268.png

 

The Input shows as ''

MikeMurillo_4-1654557071491.png

 

Thank you so much for your time, I would highly appreciate it if someone has any ideas on how to fix this.

 

 

  • Community Power Platform Member Profile Picture
    on 07 Jun 2022 at 13:10:05
    Re: ParseDateTime Blanks? Issue with IF statement

    @shoog Thank you so much!! Rookie mistake lol.

     

    I had to change the formula to this in order to make it work!

     

    if(equals(item()?['RESP_LAST_USED'], ''), null, formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'))
     
     
  • Verified answer
    shoog Profile Picture
    2,164 on 07 Jun 2022 at 05:39:58
    Re: ParseDateTime Blanks? Issue with IF statement

    The problem is the parsedatetime function in the condition part, for the comparisson you should test against the original value like this:

     

    if(equals(item()?['RESP_LAST_USED'], 'en-US', ''), null, formatDateTime(parsedatetime(item()?['RESP_LAST_USED'], 'en-US'),'MM/dd/yyyy'))

     

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

Announcing our 2025 Season 2 Super Users!

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2