How to convert integer variable type to DateTime variable?

Hi All,

I have given variable(int) Days =DateTime.DaysInMonth(Now.Year,Now.Month)
but i need to convert (int) Days to (DateTime) Days. Can anyone help me in this regards.


Welcome to the UIPath Community.

May I know why you want to convert this ?

Try this if you have date @Syed_Asimfarhan,

DateTime.FromOADate(value you have), this will give you the entire date format of the value you have :slight_smile:

Hi lakshman

I am filtering dates which is in my excel and the condition is i need to filter the dates dynamically from 15th of this month to last date of the current month.i can give only 15 and i shouldn’t give year and month it should take dynamically of current month and year.if the current month has 31 days then it should filter from 15 to 31 of this month or if this month has 30 days then it should filter from 15 to 30.

for begin date i have assigned as (date time variable type)days=new DateTime(now.Year,now.Month,15) and for total no.of days in month i have assigned as (int variable type)month=DateTime.Now.AddMonths(0).Month; i need to convert int to date Time variable type.

Hi @Syed_Asimfarhan,

  1. Date15 (Type DateTime) = New DateTime (now.Year,now.Month, 15) —> 15th of current month.
  2. days (Type Int32) = Datetime.DaysInMonth(now.Year,now.Month) —> total no of days in current month.
  3. LastDate (Type DateTime) = New DateTime(now.Year,now.Month,days) —> last date of current month. where days has total no of days. (calulated in previous assign)

I’m attaching xaml file here, go through and run it (If you need it) :slight_smile:
LastDate.xaml (5.7 KB)

Thank you @samir