Excluding weekoffs i need date

above excel snap is a dummy data. actually i need the date using get text activity. so as like excel i need to add +2 days for every date excluding weekoffs(satarday and sunday).

Thanks & Regards,
Lokesh.

Hi! Welcome to community!

For calculating business days…

For adding 2 days…

Regards,
NaNi

Hi,

Another solution:

Can you try the following expression?

dateTimeVar = DateTime.ParseExact(yourStringFromGetText,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture)

resultDateTime = dateTimeVar.AddDays(Enumerable.Range(1,2).Sum(Function(i) if({DayOfWeek.Saturday,DayOfWeek.Sunday}.Contains(dateTimeVar.AddDays(i).DayOfWeek),2,1)))

If you need string, use ToString like resultDateTime.ToString("dd/MM/yyyy")

Regards,

Thank You for the reply@yoichi. i am facing error . if possble can you please share me the xml.

Hi,

Hope the following helps you.

Sample20211231-1.zip (2.4 KB)

If there is possibility your string contains extra whitespace, please use Trim method as the following.

dateTimeVar = DateTime.ParseExact(yourStringFromGetText.Trim,"dd/MM/yyyy",System.Globalization.CultureInfo.InvariantCulture)

Regards,

Don’t use Get Text for Excel. Use Read Range to read the sheet into a datatable. Then manipulate the data in the datatable to what you want. Then Write Range back to the sheet.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.