To list available contexts: kubectl config get-contexts To show the current context: kubectl config current-context…
Getting the Starting Day of the Week for Any Date
From my code snippets, here’s a function that will return the starting day of the week for any date:
/// <summary>
/// Gets the start of the week that contains the specified date.
/// </summary>
/// <param name="date">The date.</param>
/// <param name="weekStartsOn">The day that each week starts on.</param>
/// <returns>The start date of the week.</returns>
public static DateTime GetStartOfWeek(DateTime date, DayOfWeek weekStartsOn)
{
int days = date.DayOfWeek - weekStartsOn;
DateTime startOfWeek = days>=0 ? date.AddDays(-days) : date.AddDays(-7 - days);
return startOfWeek;
}
[…] – Getting the Starting Day of the Week for Any Date | Lighten Color in […]