Need to edge out the competition for your dream job? Train for certifications today.
var StartDate = DateTime.Now;
for (var i = 0; i < 6; i++)
Open in new window
Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.
static void Main(string args)
string str = DateTime.Now.ToString("MM");
int resMonth = IterateDownMonth(int.Parse(str), 7, 8);
static int IterateDownMonth(int initMonth, int subMonths, int iterations)
while (iterations-- > 0)
initMonth -= subMonths;
initMonth = initMonth > 0 ? initMonth : initMonth + 12;
DateTime dt = DateTime.Now
for(int i = 0 ; i <6; i++)
string strDisplay = dt.AddMonths(-i).ToString("MM");
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.