web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / addHours produces diff...
Power Automate
Unanswered

addHours produces different date/times

(0) ShareShare
ReportReport
Posted on by

Hi,

I have a Flow that uses this function in two settings:

 

addHours(utcNow(),10)

 

1st setting: used as is to populate a SharePoint Date/Time column

2nd setting: used to build a concatenating text field in SP for audit purposes

 

The issue is that I get 2 different times in my columns, see below

UTC_Now difference.jpg

Here's the flow setup in question:

UTC_Now differenceFLOW.jpg

 

Can anyone explain why this is? Do I just need to drop the addHours() function from the ApprovalDateTime column and just use Now(). This is the column that is giving the incorrect date/time.

 

Thanks

 

 

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    Change the expression to

     

    formatDateTime(addHours(utcNow(),10),'yyyyMMdd_HH:mm tt')
     
    Thanks
  • Community Power Platform Member Profile Picture
    on at

    @abm 

    Won't that expression convert the date to a string? I want one column to be a date and the other to be part of a string.

     

    Just wondering why they are different

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    In your format you used small hh

     

    yyyyMMdd_HH:mm tt

     

    Thanks

  • Community Power Platform Member Profile Picture
    on at

    @abm 

    Can you explain why this matters? 

     

    Im not sure I've explained myself properly. 

     

    I want column ApprovedDateTime to be a date and time. I use addHours(utcNow(),10) to fill this column.

     

    I want the column ApprovalStages to reflect the same date and time as the column ApprovedDateTime. I use addHours(utcNow(),10) in this column but convert it to a string.

     

    As you can see, the dates and times don't match yet they are generated at the same time in the same Flow using the same expression, ie addHours(utcNow(),10).

     

    Im just trying to find out why there's a mismatch.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    You have a specific format

     

    formatDateTime(addHours(utcNow(),10),'yyyyMMdd_hh:mm tt')
     
    Where as in you other column you are using addHours(utcNow(),10)
     
    Of course it will be different with seconds  time difference.
     
    If you looking for the same then declare a compose above and use the expression addHours(utcNow(),10) then refer this in your columns.
     
    What I noticed is if you using format 'yyyyMMdd_hh:mm tt' and 'yyyyMMdd_HH:mm tt' there are differences in the output.
     
    Thanks
     
     
  • Community Power Platform Member Profile Picture
    on at

    @abm 

    The two values do not differ by seconds, they differ by 10 hours.

     

    ie 19/03/2020 1:02 AM vs 18/03/2020 3:02 PM

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    addHours(utcNow(),10) I got

     

    2020-03-18T22:36:17.7650610Z (Correct)

     

    formatDateTime(addHours(utcNow(),10),'yyyyMMdd_hh:mm tt') I got
     

    20200318_10:36 PM (Correct)

     

    formatDateTime(addHours(utcNow(),10),'yyyyMMdd_HH:mm tt') I got

    20200318_22:37 PM (Correct - Here 24 hours format)

     

     

     

  • Community Power Platform Member Profile Picture
    on at

    @abm 

    Ok, if that's the case then why are the date/times different for me and not you (see my picture above)?

     

    Could my SharePoint site be doing something weird with the dates or could it be that the formatDateTime expression sits inside a concat() expression? I'm struggling to understand why the two expressions yield a 10hr difference.

  • abm abm Profile Picture
    32,865 Most Valuable Professional on at

    Hi @Anonymous 

     

    19/03/2020 1:02 AM vs 18/03/2020 3:02 PM

     

    Not sure which expression you are using to produce these.

     

    18/03/2020 3:02pm adding 10 hours in your expression gives 19/03/2020 1:02 AM

    which is correct

     

    addHours(utcNow(),10)
     
    formatDateTime(addHours(utcNow(),10),'yyyyMMdd_hh:mm tt')
  • Community Power Platform Member Profile Picture
    on at

    @abm 

    19/03/2020 1:02 AM vs 18/03/2020 3:02 PM Comes from the very first picture I posted. The arrows show which columns are filled by my Flow using which expression, maybe have a second look if you are unsure?

     

    The expression used to fill ApprovedDateTime is addHours(utcNow(),10)

     

    The expression used to fill ApprovalStages is concat(...formatDateTime(... addHours(utcNow(),10)...)

     

    So, the way I see it is that addHours(utcNow(),10), is used in both expressions BUT they output 19/03/2020 1:02 AM vs 18/03/2020 3:02 PM respectively. Why?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard