How to find the last date in current month ?
For example if today is 12/20/2019 then i need to find the last date in the month of december . It should be 12/31/2019.
Please help me
How to find the last date in current month ?
For example if today is 12/20/2019 then i need to find the last date in the month of december . It should be 12/31/2019.
Please help me
Hi,
The following might help you.
(New DateTime(Today.AddMonths(1).Year,Today.AddMonths(1).Month,1)).AddDays(-1)
or
(New DateTime(Today.AddMonths(1).Year,Today.AddMonths(1).Month,1)).AddDays(-1).toString("MM/dd/yyyy")
Regards,
Hello @vamsi.battulaus008
You can use the following C# code in the assign activity to get the first and last day of the current month:
DateTime now = DateTime.Now;
var startDate = new DateTime(now.Year, now.Month, 1);
var endDate = startDate.AddMonths(1).AddDays(-1);
Hope this helps you.
Try using DaysInMonth option as following
New DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month))
New DateTime(cdate(date1).Year,cdate(date1).Month,DateTime.DaysInMonth(cdate(date1).Year,cdate(date1).Month))
Here Date1=“12/28/2019”
Similar solution worked for me:
New DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).toString(“dd”)
in_RunPeriod.AddMonths(1).AddDays(-in_RunPeriod.Day).ToString(“MM/dd/yyyy”)