ThisWeekFriday

public static DateTime ThisWeekFriday(this DateTime dt)
{
  var today = DateTime.Now;
  return new GregorianCalendar().AddDays(today, -((int)today.DayOfWeek) + 5);
}
Example:
var friday = DateTime.Now.ThisWeekFriday();

Description

Returns a DateTime representing the Friday of the current week. Depends on System.Globalization.

Details

Double click on the code to select all.

 

;