How to get previous month with no of days
and current year
Eg: if the month is June the value should be 20210531
first line is returning a datetime
second line is retruning as string
Hi,
An alternative:
DateTime.Now.AddDays(-DateTime.Now.Day).ToString("yyyyMMdd")
Will always get the last date of previous month.
1 Like