Update the time within a DateTime attribute

Scenario: We're passing in a DateTime object into a microflow and retrieving a list of objects that are greater than or equal to that DateTime object. We need to iterate over the list of DateTime objects and update the TIME of each one to match the time of the object passed in (not the date!). Our idea was to try using the formatTime() function to extract the time from the object passed in as a string and then utilise that; but the addHours() function doesn't accept strings and we cannot parse the string time in format "hh:mm" as an integer or decimal, so we're pretty stuck!
1 answers


  • Get the time of the passed in date (as a string) using formatDateTime and the appropriate time string like 'hh:mm a'
  • In your loop, get the date of each loop object using the same function and a format like 'MM/dd/yy'
  • Now set the date of your loop object using parseDateTime, concatentate your two strings together and use a date time format pattern that is the same as what you used for your first two steps, like 'MM/dd/yy hh:mm a'

Hope that helps,