September 18, 2020

The addHours Function works just like the addSeconds Function and other similar functions. It adds the number of hours to a specific date, based on a particular format.


It follows a simple pattern.

  1. Date
  2. Number of hours to add/remove
  3. (Optional) Date Format


addHours('2019-10-28T10:10:00Z', 10,'yyyy-MM-ddTHH:mm:ssZ')

will return 


Looks quite straightforward, right? Positive numbers add hours, and negative excludes them.

Please be aware that the reference material, Microsoft names objects like ‘2019-10-28T10:10:00Z’ as timestamps. I prefer calling them “Date” to avoid confusion with the UNIX timestamp, commonly used in APIs, to represent the number of seconds elapsed since Jan 01 1970 (UTC).


Contrary to SharePoint and Power Apps, there’s no limitation to the date that you can use. You can do things like:


and you'll get 


They behave like you’re expecting.


  1. Always include the format, even if the value is optional. The default value is “yyyy-MM-ddTHH:mm:ss:fffffffK” but the date provided may not be stored in the same format and will return either wrong times or errors. You can define a single format specifier (for example “o”) or a custom format pattern (for example “yyyy-MM-dd”) so pick your favorite, but be sure to define it.
  2. There are analogous functions for days, minutes, and seconds, so don’t do any math trying to use the addMinutes Function to add hours, for example.
  3. Complementary to the addHours Function, you can also use the addToTime Function. I recommend using the addHours Function because it makes the formula more readable, but the result is the same.


Microsoft’s addHours Function Reference

Back to the Power Automate Function Reference.

Featured Image by Cyle De Guzman on Unsplash

Manuel Gomes

I'm a Project Manager with experience in large projects and companies. I've worked in the past for companies like Bayer, Sybase (now SAP) and I'm currently working for Pestana Hotel Group.

View all posts by Manuel Gomes →

Leave a Reply

%d bloggers like this: