<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Time difference between two date and time in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260520#M778940</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay, u can do like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a calculates keyfigure as mentioned below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from calculated keyfigure screen&lt;/P&gt;&lt;P&gt;create two variables, one for start date and other for end date.&lt;/P&gt;&lt;P&gt;and calculate the difference between these dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you will get difference between days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And  to calculate the difference in working days, u can use the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use function Module : HOLIDAY_GET to get holidays between two provided dates and provided calender.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In update rules, create 2 variables(l_date1, l_date2) of type SY-Datum and one for date_diff type N.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date_diff = l_date1 - l_date2 -(no. of holidays).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly reward if found helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 20 Jan 2008 05:26:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-20T05:26:09Z</dc:date>
    <item>
      <title>Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260518#M778938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an urgent requirement to calculate days,hours,minutes and seconds between first creation order (date and time), and confirmed creation order (Date and time.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g Begin Date 02.01.2008 Begin Time 11:12:23 &lt;/P&gt;&lt;P&gt;      End Date 08.01.2008 End Time 12:12:28&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i have to find days,hours,minutes and seconds between The Begin Data(date and Time)&lt;/P&gt;&lt;P&gt; and End Data(date and Time).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know if there is any FM which could help me or any other way to solve this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All helpful ans will be immediately rewarded&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jan 2008 14:07:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260518#M778938</guid>
      <dc:creator>Vijay</dc:creator>
      <dc:date>2008-01-19T14:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260519#M778939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can use the FM &lt;STRONG&gt;SALP_SM_CALC_TIME_DIFFERENCE&lt;/STRONG&gt; to get the difference in seconds.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To calculate the days, hours, etc you can use the &lt;STRONG&gt;DIV&lt;/STRONG&gt; and &lt;STRONG&gt;MOD&lt;/STRONG&gt; function like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;days = seconds DIV 86400. &lt;/P&gt;&lt;P&gt;rest = seconds  MOD 86400. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hours = rest DIV 3600.&lt;/P&gt;&lt;P&gt;rest = rest MOD 3600.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;minutes = rest DIV 60.&lt;/P&gt;&lt;P&gt;seconds = rest mod 60.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jan 2008 16:47:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260519#M778939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-19T16:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260520#M778940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay, u can do like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a calculates keyfigure as mentioned below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from calculated keyfigure screen&lt;/P&gt;&lt;P&gt;create two variables, one for start date and other for end date.&lt;/P&gt;&lt;P&gt;and calculate the difference between these dates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you will get difference between days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And  to calculate the difference in working days, u can use the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use function Module : HOLIDAY_GET to get holidays between two provided dates and provided calender.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In update rules, create 2 variables(l_date1, l_date2) of type SY-Datum and one for date_diff type N.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date_diff = l_date1 - l_date2 -(no. of holidays).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kindly reward if found helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2008 05:26:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260520#M778940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-20T05:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260521#M778941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay, also try this, this will solve ur problem. I guess.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use function module : it works,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HR_HK_DIFF_BT_2_DATES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;give output format = 03 and get the value in days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code is as below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : DATE1 type P0001-BEGDA,&lt;/P&gt;&lt;P&gt;DATE2 type P0001-BEGDA,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YEARS type P0347-SCRYY,&lt;/P&gt;&lt;P&gt;MONTHS type P0347-SCRMM,&lt;/P&gt;&lt;P&gt;DAYS type P0347-SCRDD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date1 = '20070331'.&lt;/P&gt;&lt;P&gt;date2 = '20070101'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;DATE1 = date1&lt;/P&gt;&lt;P&gt;DATE2 = date2&lt;/P&gt;&lt;P&gt;OUTPUT_FORMAT = '03'&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;YEARS = years&lt;/P&gt;&lt;P&gt;MONTHS = months&lt;/P&gt;&lt;P&gt;DAYS = days&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INVALID_DATES_SPECIFIED = 1&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;OTHERS = 2&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write : days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Hema.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2008 05:27:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260521#M778941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-20T05:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260522#M778942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%DIFF(op1:op2:&lt;STRONG&gt;MSECONDS|&lt;/STRONG&gt;SECONDS|&lt;STRONG&gt;MINUTES|&lt;/STRONG&gt;HOURS|&lt;STRONG&gt;DAYS|&lt;/STRONG&gt;MONTHS|*YEARS)&lt;/P&gt;&lt;P&gt;%DIFF(op1:op2:&lt;STRONG&gt;MS|&lt;/STRONG&gt;S|&lt;STRONG&gt;MN|&lt;/STRONG&gt;H|&lt;STRONG&gt;D|&lt;/STRONG&gt;M|*Y)%DIFF produces the difference (duration) between two date or time values. The first and second parameters must have the same, or compatible types. The following combinations are possible: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Date and date &lt;/P&gt;&lt;P&gt;Time and time &lt;/P&gt;&lt;P&gt;Timestamp and timestamp &lt;/P&gt;&lt;P&gt;Date and timestamp (only the date portion of the timestamp is considered) &lt;/P&gt;&lt;P&gt;Time and timestamp (only the time portion of the timestamp is considered).&lt;/P&gt;&lt;P&gt;The third parameter specifies the unit. The following units are valid: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For two dates or a date and a timestamp: *DAYS, *MONTHS, and *YEARS &lt;/P&gt;&lt;P&gt;For two times or a time and a timestamp: *SECONDS, *MINUTES, and *HOURS &lt;/P&gt;&lt;P&gt;For two timestamps: *MSECONDS, *SECONDS, *MINUTES, *HOURS, *DAYS, *MONTHS, and *YEARS&lt;/P&gt;&lt;P&gt;The difference is calculated by subtracting the second operand from the first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result is rounded down, with any remainder discarded. For example, 61 minutes is equal to 1 hour, and 59 minutes is equal to 0 hours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value returned by the function is compatible with both type numeric and type duration. You can add the result to a number (type numeric) or a date, time, or timestamp (type duration).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you ask for the difference in microseconds between two timestamps that are more than 32 years 9 months apart, you will exceed the 15-digit limit for duration values. This will result in an error or truncation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For more information, see Date Operations or Built-in Functions&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;vasavi.&lt;/P&gt;&lt;P&gt;reward if helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2008 06:56:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260522#M778942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-20T06:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Time difference between two date and time</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260523#M778943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vasavi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please don't be cross with me, but your hint is from the Websphere Development studio for iSeries to program in &lt;STRONG&gt;ILE RPG&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;[http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.ibm.etools.iseries.langref.doc/c0925086623.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However this is the &lt;STRONG&gt;ABAP&lt;/STRONG&gt; forum...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With kind regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 20 Jan 2008 07:15:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/time-difference-between-two-date-and-time/m-p/3260523#M778943</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-20T07:15:40Z</dc:date>
    </item>
  </channel>
</rss>

