cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eenochs
Helper III
Helper III

Remove time from a Date Column

I am working on a flow where I'm comparing a date expression with a Document library column.  I want to compare the dates only and not the times.  The Document library column is showing the time so my condition will always be false because of the time.  Is there a way to strip out the time of a column?  On the column settings, i have it set to show Date only but that only seems to affect the Doc Library column itself.  I tried a compose field and used this command but getting an error trying to save the flow. 

 

formatDateTime(outputs('Email_x0020_Send_x0020_Date0'),'yyyy-MM-dd')

eenochs_0-1626359432097.png

 

Thoughts?

 

1 ACCEPTED SOLUTION

Accepted Solutions
eenochs
Helper III
Helper III

Thanks all for the suggestions and something i will take into account in the future but i did solve it using the Convert Time Zone that i placed in the Apply to each and moved that before the condition.  From there i was able to use the Convert option and compared that to the outputs of the compose.  

eenochs_0-1626864095032.png

 

View solution in original post

10 REPLIES 10
tom_riha
Super User
Super User

Hello @eenochs ,

if you're using a Filter Query in the 'Get files...' action, then you can't format the column in any way. For the Filter Query the column must stay in its original format, including the time.

Instead of the 'eq' condition on a date you'll need two conditions: 'ge' (greater or equal) the day at 00:00:00 and 'lt' (less than) the next day at 00:00:00, e.g.

(Date ge '@{addDays(utcNow(),1,'yyyy-MM-dd')}') and (Date lt '@{addDays(utcNow(),2,'yyyy-MM-dd')}')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

I am using a filter query on the Get Files to filter out folders from the review.  

Just an update, I removed output from the command and it seems to be working, just getting a ISO Format error on the date.  

eenochs_0-1626361627895.png

 

Hello @eenochs ,

it would be best if you shared the whole Filter Query you've got, without that it's hard to solve.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

ContentType ne 'Folder'

I’m sorry, I meant the part that’s throwing the error/not working. 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Just to make sure i was clear (which i don't think i was) in what i was looking at.  I have a column in a document library labeled Email send date.  This is a calculated column that if the email send date is equal to today it would send an email.  

 

The problem i believe i'm having is the Email Send Date has the date and time in it.  So when that is compared to today it doesn't match because of the time.  I was hoping to strip out the time in Email Send Date and so it would only compare the days.  

 

eenochs
Helper III
Helper III

Sorry about that,  here is the error and what i currently have in the get files and what i have in my condition. 

eenochs_0-1626369451468.png

Here is the flow

eenochs_1-1626369511736.png

 

 

It won’t work without the outputs(…) as this way you’re not referencing output from any action. It must be in the similar way as you had it originally. 
Try to add ‘Compose’ before the condition and store the date in there, that way you’ll see what value the dynamic content has and maybe why formatDateTime didn’t like it



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Hi @eenochs :

I suggest you use the "StartofDay" function to convert the time of the two dates to 0 o'clock of the day and then compare them.In this way, the impact of time can be ignored.

vbofengmsft_0-1626765810039.png

I think this link will help you a lot:

startOfDay

Best Regards,

Bof

eenochs
Helper III
Helper III

Thanks all for the suggestions and something i will take into account in the future but i did solve it using the Convert Time Zone that i placed in the Apply to each and moved that before the condition.  From there i was able to use the Convert option and compared that to the outputs of the compose.  

eenochs_0-1626864095032.png

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,335)