<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Get a work day in the past from a day in the future</title><link>https://answers.axonivy.com/questions/1392/get-a-work-day-in-the-past-from-a-day-in-the-future</link><description>&lt;p&gt;I am using the following code to get a work days in the future or past.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;in.terminateEndDateTime = ivy.cal.getWorkDayIn(in.terminateStartDateTime, in.days);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;When I use the API with negative days, the API does not return a date in the past, instead the given (or current) date is returned. Example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;IBusinessCalendar.getWorkDayIn(-10) // returns current date, without any calculation
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Have anyone an idea? THX for the help.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1392/get-a-work-day-in-the-past-from-a-day-in-the-future" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 09 Jul 2015 15:26:43 -0400</lastBuildDate><item><title>Answer by Flavio Sadeghi</title><link>https://answers.axonivy.com/questions/1392/get-a-work-day-in-the-past-from-a-day-in-the-future/1395</link><description>&lt;p&gt;Thanks for reporting.&lt;/p&gt;
&lt;p&gt;I have just analysed and fixed the method &lt;code&gt;IBusinessProcess.getWorkDayIn(...)&lt;/code&gt;. See Issue &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#25593: BusinessCalendar.getWorkDayIn(...) with a negative relative-work-day as parameter returns passed date
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It works now as exected. The following examples shows its usage:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;All days of the week are working days, except the Sunday is a day off.
------------------------------------
| FR | SA | SU (day off) | MO | TU |
------------------------------------
getWorkDayIn(SA, 0) -&amp;gt; SA
getWorkDayIn(SA, 1) -&amp;gt; MO
getWorkDayIn(SA, -1) -&amp;gt; FR (FIXED: before SA)

getWorkDayIn(SU, 0) -&amp;gt; MO
getWorkDayIn(SU, 1) -&amp;gt; TU (FIXED: before MO)
getWorkDayIn(SU, -1) -&amp;gt; SA (FIXED: before SU)

getWorkDayIn(MO, 0) -&amp;gt; MO
getWorkDayIn(MO, 1) -&amp;gt; DI
getWorkDayIn(MO, -1) -&amp;gt; SA (FIXED: before MO)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The fix will be included in the next Hotfix (5.1.6) by the end of next week. Available on our &lt;a href="http://developer.axonivy.com/download/"&gt;download page&lt;/a&gt; . &lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Flavio Sadeghi</dc:creator><pubDate>Thu, 09 Jul 2015 15:26:43 -0400</pubDate><guid>https://answers.axonivy.com/questions/1392/get-a-work-day-in-the-past-from-a-day-in-the-future/1395</guid></item></channel></rss>