I want a last day of current month and want to use if condition.
If it is last day of month
Then it is true
Else false
Hi @Ak_4
Check out this expression
(New DateTime(Today.AddMonths(1).Year,Today.AddMonths(1).Month,1)).AddDays(-1).toString("MM/dd/yyyy")
Regards
Gokul
Hi @Ak_4 ,
What about below
New DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).tostring(“dd-MM-yyyy”)
Output
Thanks,
HI @Ak_4
Use this expression in If activity
(New DateTime(Today.AddMonths(1).Year,Today.AddMonths(1).Month,1)).AddDays(-1).toString("MM/dd/yyyy")=DateTime.Now.ToString("MM/dd/yyyy")
Regards
Gokul
on datatetime base:
we can calculate the last day of month by:
lastDay | DateTime =
YourDateTimeVar.AddDays(-YourDateTimeVar.day + 1).AddMonths(1).AddDays(-1)
within an if activity we do check e.g
lastDay.Date = yourCompareDateVar.Date
When date info is available as String we do first parse it into datetime by one of the following options:
- CDate(…)
- Convert.ToDateTime(…)
- DateTime.ParseExact(…)
Hi,
Another approach:
In the latest UiPath System.Activities package, we can use ModifyDateActivity to easily get Last day of the month as the following.
Then we can check using If activity.
Regards,
Hello @Ak_4
Here you can use the Modify date activity and an if activity. Can check the below video to understand the usage of Modify date activity.
Thanks
If(Datetime.DaysInMonth(Now.Year,Now.Month)=Now.Day,True,False)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.