using System.Collections.Generic;
private static DateTime GetMondayOfCurrentWeek()
DateTime today = DateTime.Today;
int daysUntilMonday = ((int)today.DayOfWeek - (int)DayOfWeek.Monday + 7) % 7;
DateTime monday = today.AddDays(-daysUntilMonday);
private static int GetTSForDateTimeNowForCurrentWeek(DateTime now)
DateTime monday = GetMondayOfCurrentWeek();
TimeSpan timeSinceMonday = now - monday;
int hoursSinceMonday = (int)Math.Max(0, timeSinceMonday.TotalHours);
public static void Main()
var dateTimeEvolving = new DateTime(2023, 06, 12, 23, 59, 00);
for(int i = 0; i < 7; i++) {
Console.WriteLine("dateTimeEvolving: " + dateTimeEvolving);
Console.WriteLine("GetMondayOfCurrentWeek: " + GetMondayOfCurrentWeek());
Console.WriteLine("GetTSForDateTimeNowForCurrentWeek: " + GetTSForDateTimeNowForCurrentWeek(dateTimeEvolving) + "\n\n");
dateTimeEvolving = dateTimeEvolving.AddDays(1);