get the last day of a month according to the date that is in the UiPath cell
ejemplo
Columna A
17\2\2022
20\3\2022
resultado
Columna B
28\2\2022
31\3\2022
get the last day of a month according to the date that is in the UiPath cell
ejemplo
Columna A
17\2\2022
20\3\2022
resultado
Columna B
28\2\2022
31\3\2022
Use a loop to get each value
Datetime.DaysInMonth(currentorw("ColumnA").ToString.Split("\",StringSplitOptions.None)(2),currentorw("ColumnA").ToString.Split("\",StringSplitOptions.None)(1)) + currentorw("ColumnA").ToString.Split("\",2,StringSplitOptions.None)(1)
Basically Datetime.DayInMonth(Year,Month) will give the last day or the days in that month
cheers
the 1 and 2 that are are from the row?
or is it the function?
because the column has a lot of data
Then use a direct excel formula …just add this formula in a new cell usign write cell and then use auto fill range activity…all will be added automatically
=EOMONTH(F2, 1)
1 and 2 in above are from function only…only columnname is what you need to change…but yes for each might take time
The current method of excel formula is faster for this
cheers
Edited it …please check this
Datetime.DaysInMonth(Cint(currentorw("ColumnA").ToString.Split("\",StringSplitOptions.None)(2)),Cint(currentorw("ColumnA").ToString.Split("\",StringSplitOptions.None)(1))) + "\" + currentorw("ColumnA").ToString.Split("\",2,StringSplitOptions.None)(1)
cheers
HI @PD14
Checkout this expression
(From d In dt.AsEnumerable
Let r = If(String.IsNullOrEmpty(d(0).Tostring),"",New DateTime(DateTime.ParseExact(d(0).ToString,{"dd/M/yyyy hh:mm:ss","dd/M/yyyy","M/dd/yyyy","M/dd/yyyy hh:mm:ss","d/M/yyyy hh:mm:ss","d/M/yyyy","M/d/yyyy","M/d/yyyy hh:mm:ss","dd/MM/yyyy","MM/dd/yyyy hh:mm:ss","MM/dd/yyyy","dd.MM.yyyy hh:mm:ss"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DatetimeStyles.None).Year,DateTime.ParseExact(d(0).ToString,{"dd/MM/yyyy","MM/dd/yyyy hh:mm:ss","MM/dd/yyyy","dd.MM.yyyy hh:mm:ss"},System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DatetimeStyles.None).AddMonths(1).Month,1).AddDays(-1).ToString("dd/MM/yyyy"))
Select dt2.LoadDataRow({d(0),r},True)).CopyToDataTable
Regards
Sudharsan
Hello @PD14
Try this
ProcessDase= DateTime.ParseExact("17/2/2022","d/M/yyyy",System.Globalization.CultureInfo.InvariantCulture).AddMonths(1)
Currentrow(EndMonthDateColum)=DateSerial(ProcessDate.Year,ProcessDate.Month,0).ToString("d-M-yyyy")
In ProcessDate variable, the format needs to update as your value.
If possible send some sample inputs, we tried to provide the XAML file for your better understanding.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.