Answers for "how to iterate between hour range in c#"

C#
0

how to iterate between hour range in c#

DateTime testDate = new DateTime(2011, 12, 15, 00, 00, 00, DateTimeKind.Local);
DateTime endDate = testDate.AddDays(1);

while (testDate.Date != endDate.Date)
{
    Console.WriteLine(testDate.ToString());
    testDate = testDate.AddHours(1);
}
Posted by: Guest on April-01-2021

C# Answers by Framework

Browse Popular Code Answers by Language