cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
beanybone
Helper I
Helper I

Date and Time formatting

Hi Everyone, I'm having an issue with dates in my flow. 

 

I am referencing a date in an excel spreadsheet that is populated from a form. As it's populated from a form it pulls date and time. 

 

My flow looks for a date in a spreadsheet and if it is 21 days or older it deletes a row. I have 3 compose functions as follows;

 

Compose 1 - 'Date completed' taken from spreadsheet

Compose 2 - addDays('1899-12-30',int(outputs('Compose')),'yyyy-MM-dd')

Compose 3 - formatDateTime(addDays(utcNow(), -21),'yyyy-MM-dd')

 

Compose 2 is failing as compose 1 is pulling 44174.389537037 instead of just 44174 for example.

 

without manually updating the date in the spreadsheet I can't get it to just pull date and I can't find a setting in the forms to only record date, not time. 

 

Can you help? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@beanybone Yep.. That was I had suggested.. My Variable was timeround yours is Compose output which hold the date variable 🙂

 

int(first(split(string(<Date Completed>)),'.')))

 

I am glad that the problem has resolved.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

10 REPLIES 10
CFernandes
Super User III
Super User III

Hey MAte @beanybone 

 

CFernandes_0-1618566387803.png

 

int(first(split(string(variables('timeround')),'.')))
 
CFernandes_1-1618566421069.png

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

hey, thanks. where in my flow do I add this compose? 

Hello @beanybone 

 

CFernandes_0-1618567431617.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Sorry you lost me, this is how my flow is set up, when I try to insert the above I just get errors

 

beanybone_1-1618568195172.png

 

Hey @beanybone 

 

Try to replace the action in screenshot below with 

 

CFernandes_0-1618569255731.png

 

int(first(split(string(<Date Completed>)),'.')))

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

Afraid not, I get an error to say the expression is invalid.

OK!! What is the error? What the Datatype returned by your Date Completed?

 

Perhaps it returns a number, you can use the Format number action to Format any number.

 

CFernandes_0-1618577591098.png

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

I don't get that far it won't let me enter the expression, when I type it in and press ok, it pops up that the expression is invalid? 

I managed to figure it out, it might be a little clunky but ... 

 

instead of replacing the initial 'date completed' compose as you suggested, I added another with the following

int(first(split(string(outputs('Compose')),'.')))

and seems to have done the trick! 

@beanybone Yep.. That was I had suggested.. My Variable was timeround yours is Compose output which hold the date variable 🙂

 

int(first(split(string(<Date Completed>)),'.')))

 

I am glad that the problem has resolved.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,617)