cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Date Format

result.JPG
My SQL Query results pulls in a date. I need to take this date, add 365 days to it, and compare that date to utcNow. I do not know how to format the date to look like utcNow in order to compare

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous 

Hi there!  You can do all this with an expression, but I don't know how, so here's my version Man Happy:   Look for this action "Add to Time" to add the 365 days to the date.20190719b.PNG

From there, you can use the Convert Time Zone function to format the date however you'd like (the from and to timezones can both be UTCz).

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

View solution in original post

4 REPLIES 4

@Anonymous 

Hi there!  You can do all this with an expression, but I don't know how, so here's my version Man Happy:   Look for this action "Add to Time" to add the 365 days to the date.20190719b.PNG

From there, you can use the Convert Time Zone function to format the date however you'd like (the from and to timezones can both be UTCz).

 

Keep us posted.

-Ed-

 

 

If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

Anonymous
Not applicable

I'm new to Flow and I did not know Add to time was an option so thanks for that @edgonzales . The problem that I am getting is with the date itself. My problem is I do not know how to take the sql output and convert it to just the date and making that date 8601 format

 

Error.JPG

Ah, ok.  So, if you do the Convert Time zone first, then you can format it before the add time step.  OR, you can use this expression in the add-time step (the stuff in red you would replace with the dynamic output from your SQL (let me know if you need help there)):

 

formatDateTime(body('Get_user_profile_(V2)')?['hireDate'],'yyyy-MM-ddTHH:mm:ssZ')
 
Or, (even better) add the days and format the thing all at once (this was new to me):
 
addDays(body('Get_user_profile_(V2)')?['hireDate'],365,'yyyy-MM-ddTHH:mm:ssZ')
 
When it comes to comparing the dates, I did this blog a while back that talks about the weirdness that is date math in Flow.
Give that a go and let us know what happens.

Hi @Anonymous 

 

Please see the screenshot below: 

js.PNG

Here, I have directly put the original date in the variable as a hardcoded value, you can reference it to the output from the previous actions. 

Expression used to format the date and add days: 

addDays(formatDateTime(variables('ss'),'yyyy-MM-ddThh:mm:ss'),365)

And then compare with utcnow()

 

Hope this Helps!

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!

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,071)