<?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>Calculate Business hours &amp;amp; Minutes between two date &amp;amp; Time</title><link>https://community.appian.com/discussions/f/general/28432/calculate-business-hours-minutes-between-two-date-time</link><description>Hi Team, 
 Looking for a function which can provide hours and minute difference between two date and time considering business calendar. 
 
 calworkhours() only provide hours plus it rounds off it to nearest hour. 
 Looking for below calculation : 
 Start</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Calculate Business hours &amp; Minutes between two date &amp; Time</title><link>https://community.appian.com/thread/111497?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2023 17:30:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bc957f5c-5b08-4e4c-a42f-619d3b4fa55b</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;Salute to the effort you have put in.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t even have courage to understand this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculate Business hours &amp; Minutes between two date &amp; Time</title><link>https://community.appian.com/thread/111417?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2023 07:58:51 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:09e75b30-ffab-498e-991b-4a2b24d773d9</guid><dc:creator>ritikv9840</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi please refer to the below code, without plugin&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!startdate: datetime(2023, 4, 20, 10, 0, 0),
  local!enddate: datetime(2023, 4, 24, 11, 30, 0),
  local!workday: calworkdays(local!startdate, local!enddate),
  local!HoursofStartdate: hour(local!startdate),
  local!Hoursofenddate: hour(local!enddate),
  local!MinutesofStartdate: minute(local!startdate),
  local!Minutesofenddate: minute(local!enddate),
  local!UpdateHoursofStartdate: if(
    local!HoursofStartdate &amp;gt;= 9,
    local!HoursofStartdate - 9,
    5 - local!HoursofStartdate
  ),
  local!daycount: if(
    local!MinutesofStartdate = 0,
    local!UpdateHoursofStartdate,
    if(
      local!HoursofStartdate &amp;gt;= 9,
      local!UpdateHoursofStartdate + 1,
      local!UpdateHoursofStartdate - 1
    ),
    
  ),
  local!firstdaycount: if(
    local!HoursofStartdate &amp;gt;= 9,
    8 - local!daycount,
    local!daycount
  ),
  local!Mcount: if(
    local!MinutesofStartdate = 0,
    0,
    60 - local!MinutesofStartdate
  ),
  local!lastdayCountcount2: local!Hoursofenddate - 9,
  local!x: local!Minutesofenddate + local!Mcount,
  local!y: if(local!x &amp;gt; 59, mod(local!x, 60), local!x),
  local!total1: if(
    local!x &amp;gt; 59,
    local!lastdayCountcount2 + local!firstdaycount + 1,
    local!lastdayCountcount2 + local!firstdaycount
  ),
  local!total: a!forEach(
    items: enumerate(local!workday - 2) + 1,
    expression: local!total1 + 8 * fv!index
  ),
  local!res: local!total[local!workday - 2] &amp;amp; &amp;quot;Hour &amp;quot; &amp;amp; local!y &amp;amp; &amp;quot;minute&amp;quot;,
  local!res
)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Calculate Business hours &amp; Minutes between two date &amp; Time</title><link>https://community.appian.com/thread/111400?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2023 05:55:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:00ab627a-59d7-4c21-b302-88daced818e4</guid><dc:creator>sanchitg0002</dc:creator><description>&lt;p&gt;OOTB calendar functions seems to be missing a function that calculate work minutes between two datetimes.&lt;/p&gt;
&lt;p&gt;You can use the free &lt;a href="/b/appmarket/posts/calendar-functions-plug-in"&gt;Calendar function&lt;/a&gt;&amp;nbsp;plugin available in Appmarket and use the below expression.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!minutes: calworkminutesplugin(ri!startTime, ri!endTime),
  a!map(
    hours: quotient(local!minutes, 60),
    minutes: mod(local!minutes, 60)
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>