<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/discussions/f/general/21844/how-to-find-difference-of-minutes-between-2-time-parameter</link><description>how to find difference of minutes between 2 time parameter. 
 For example i have StartTime: 6:00 PM, and EndTime: 7:30PM.</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/thread/85608?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 20:54:19 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2c129286-8105-4f0f-a7fa-b5c8c7fbe048</guid><dc:creator>vimalkumars</dc:creator><description>&lt;p&gt;I usually use the below expressions:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Expression to find the difference between time parameter&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!time1: time(5, 00),
  local!time2: time(10, 35),
  local!differenceInMins: todecimal(local!time2 - local!time1) * 24 * 60,
  local!differenceInMins
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Expression to find the difference between date-time parameter&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!datetime1: datetime(2021,08,09,12,00,00),
  local!datetime2: datetime(2021,08,10,14,00,00),
  local!differenceInMins: todecimal(local!datetime2 - local!datetime1) * 24 * 60,
  local!differenceInMins
)&lt;/pre&gt;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/thread/85596?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 15:24:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f8e444df-4013-4005-87b7-efd5ef521ba7</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;There are a few ways to&amp;nbsp;accomplish this one,&amp;nbsp;another option is to subtract the datetime values creating an interval and parse out the result to obtain minutes as:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!date1: datetime(2021,9,7,6,30),
  local!date2: datetime(2021,9,7,7,05),
  local!interval: local!date2-local!date1,
  local!days: split(local!interval,&amp;quot;::&amp;quot;)[1],
  local!hours: split(split(local!interval,&amp;quot;::&amp;quot;)[2],&amp;quot;:&amp;quot;)[1],
  local!minutes: split(split(local!interval,&amp;quot;::&amp;quot;)[2],&amp;quot;:&amp;quot;)[2],
  
  local!days*24*60
  +
  local!hours*60
  +
  local!minutes  
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/thread/85594?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 14:47:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c361753a-3eb4-46ec-9e81-46ccb678d2d5</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;This is a good use case for a strong helper rule that can handle various similar use cases.&amp;nbsp; Years ago I created a rule that will calculate the elapsed seconds between any two DateTime rule inputs.&amp;nbsp; You can then calculate the minutes from this by dividing the result by 60 and rounding to whatever level of specificity you require.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="java"&gt;/* rule!GLBL_CalculateElapsedSeconds */
/* ri!startTime and ri!endTime are both DateTime type */

a!localVariables(
  local!days: tointeger(ri!endTime - ri!startTime),
  local!hours: hour(ri!endTime - ri!startTime),
  local!minutes: minute(ri!endTime - ri!startTime),
  local!seconds: second(ri!endTime - ri!startTime),

  if(
    local!days = 0,
    0,
    local!days * 24 * 60 * 60
  )

  +

  if(
    local!hours = 0,
    0,
    local!hours * 60 * 60
  )

  +

  if(
    local!minutes = 0,
    0,
    local!minutes * 60
  )

  +

  local!seconds
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;( Note: no need to @ me that the above code could be condensed / tightened up quite a bit... i wrote it a few years ago and have left it overly verbose for the purposes of ease of understanding - at least that&amp;#39;s my official excuse ;-) )&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/thread/85591?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 12:41:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1db1b946-6846-4439-bbae-8011f72e0f62</guid><dc:creator>Selvakumar Kumarasamy</dc:creator><description>&lt;p&gt;If you need to find the exact time difference in minutes, then this code might help you:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;(hour(ri!time2 - ri!time1) * 60) + minute(ri!time2 - ri!time1)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to find difference of minutes between 2 time parameter</title><link>https://community.appian.com/thread/85589?ContentTypeID=1</link><pubDate>Wed, 08 Sep 2021 09:42:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c82983f8-6155-4da8-8989-f3f616ac9772</guid><dc:creator>gayathris876948</dc:creator><description>&lt;p&gt;You can subtract end time -&amp;nbsp; start time&lt;br /&gt;&lt;br /&gt;time(19, 30) - time(18, 00) = 1&lt;span&gt;&lt;span class="CollapsibleOutputNode---print_value"&gt;:30 AM&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>