how to get last date of previous month on date modify activity e.g 30/11/2023 ???
Try this:
str_lastdate= New DateTime(now.Year,now.Month,1).AddDays(-1).ToString("MM/dd/yyyy")
You can change the date format as required. As per your requirement
str_lastdate= New DateTime(now.Year,now.Month,1).AddDays(-1).ToString("dd/MM/yyyy")
str_lastdate is of DataType System.String
Hope it helps!
Assign activity:
DateTime lastDayOfPreviousMonth =DateTime.Now.AddDays(-DateTime.Now.Day)
Message box
lastDayOfPreviousMonth.ToString("dd/MM/yyyy")
@Hemant_Deshmukh
Cheers
Hello @Hemant_Deshmukh
You can try to do this :
1 . Declare a variable
2 . Assign its value as n
new DateTime(now.Year , now.Month , 1).AddDays(-1).ToString(“dd/MM/yyyy”)
It will give you expected results.
How about this
lastDayOfPreviousMonth (DateTime)= New DateTime(Now.Year, Now.Month, 1).AddDays(-1)
formattedDate (String) = lastDayOfPreviousMonth.ToString(“dd/MM/yyyy”)
Try this:
DateTime.Now.AddMonths(-1).AddDays(-DateTime.Now.Day).ToShortDateString
For change Date Format as per your requirement.
DateTime.Now.AddMonths(-1).AddDays(-DateTime.Now.Day).ToString(“dd-MM-yy”)
Hope it will helps you
Cheers!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.