Hello this expression I have
New DateTime(Now.Year,Now.Addmonths(-1).Month,1).ToString(“MM/dd/yy”)
returns “12/01/22”, but I need it to be the first day of the previous month “12/01/21”, can someone please help?
thanks so much in advance
Hello this expression I have
New DateTime(Now.Year,Now.Addmonths(-1).Month,1).ToString(“MM/dd/yy”)
returns “12/01/22”, but I need it to be the first day of the previous month “12/01/21”, can someone please help?
thanks so much in advance
Hello,
Maybe just add a condition and if your current month is 01 then sub 1 year to the result ?
Hi @lynnsong986 ,
Try the below Expression :
new DateTime(Now.AddMonths(-1).Year,Now.AddMonths(-1).Month,1).ToString("MM/dd/yy")
You can use the below one.
LHS:FirstDayOfPreviousMnth
RHS:new DateTime(Date_Now.Year,Date_Now.Month,1).AddMonths(-1)
Thank you
Thank you all for your kind help!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.