How to get first day of year and last day of year

Hi Guys,

How i can get first day of previous year and last day of previous year.
eg- if my bot running in 25/2/2020 start date will be 01/01/2019 and end date will be 31/12/2019.

Please help

firstDay = new DateTime(DateTime.Now.Year.AddYears(-1), 1, 1);
lastDay = new DateTime(DateTime.Now.Year.AddYears(-1), 12, 31);

Hi,

Hope the following helps you.

new DateTime(now.Year,1,1).AddYears(-1)

new DateTime(now.Year,12,31).AddYears(-1)

Regards,

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.