FileInfo fi = new FileInfo(/*filename*/);
DateTime dateFile = fi.LastWriteTime;
DateTime now = DateTime.Now;
if (now.Year == dateFile.Year) { //same year?
if (now.Month == dateFile.Month) { //same month?
MessageBox.Show("File has been edited in this month.");
DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
Calendar c = dfi.Calendar;
int fileWeek = c.GetWeekOfYear(dateFile, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);
int nowWeek = c.GetWeekOfYear(now, dfi.CalendarWeekRule, dfi.FirstDayOfWeek);
if (fileWeek == nowWeek) { //same week?
MessageBox.Show("File has been edited in this week.");
}
}
}
This code first checks if the file was edited in the same year. The it checks its month. Then it uses the calendar class with the current DateTimeInfo(this contains things like: How many days are in one week, which is the first day of week, etc.). The function GetWeekOfYear returns the number of the week. The two integers are compared, and thre you go!
Note:
You used the LastAccessTime, but this is also updated, when you do little things on the file like click it in the explorer(so not very helpful if you want to know if the user realy opened it). Use LastWriteTime instead(This changes if the file was changed).