Get date from last week

I am trying to have variables be assigned the dates of the previous Monday and Friday so they are in this format (MM-dd-yyyy). For example if the program were to run on Tuesday Dec. 17th it would give a string as “12-09-2019” and another string as “12-13-2019”

Assign the value as DateTime.Now.AddDays(-7).ToString(“MM-dd-yyyy”)

Docs for DateTime.AddDays method:

Docs for DateTime.ToString method

1 Like

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