[Solved] how to write number of days in c# [closed]


Try to use DateTime.Now.DayOfWeek. Definition:

namespace System
{
    using System.Runtime.InteropServices;

    [Serializable, ComVisible(true), __DynamicallyInvokable]
    public enum DayOfWeek
    {
        [__DynamicallyInvokable]
        Friday = 5,
        [__DynamicallyInvokable]
        Monday = 1,
        [__DynamicallyInvokable]
        Saturday = 6,
        [__DynamicallyInvokable]
        Sunday = 0,
        [__DynamicallyInvokable]
        Thursday = 4,
        [__DynamicallyInvokable]
        Tuesday = 2,
        [__DynamicallyInvokable]
        Wednesday = 3
    }
}

Example:

// For your case Monday == 2
int todayDayOfWeekNumber = (int)DateTime.Now.DayOfWeek + 1;

5

solved how to write number of days in c# [closed]