The days in year. - CSharp System

CSharp examples for System:DateTime Year

Description

The days in year.

Demo Code

// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
using System;/*from   ww w  . j a  v a2s .  co m*/

public class Main{
        /// <summary>
        /// The days in year.
        /// </summary>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public static int DaysInYear(this DateTime value)
        {
            return DateTime.IsLeapYear(value.Year) ? 366 : 365;
        }
}

Related Tutorials