Answers for "date calculations in c#"

C#
0

date calculations in c#

//week of month calculations
    var dt = Convert.ToDateTime("2021-06-05");
        for (var t = 1; t < 30; t++)
        {
            dt = dt.AddDays(1);
            decimal numberofday = dt.Day;
            decimal d = (Math.Floor(numberofday / 7)) + 1;
            var weekofmonth = 0;
            if ((numberofday) % 7 == 0)
            {
                weekofmonth = Convert.ToInt32((d)) - 1;
            }
            weekofmonth = Convert.ToInt32(d);
        }
Posted by: Guest on June-11-2021

C# Answers by Framework

Browse Popular Code Answers by Language