Returns first day of the year. - CSharp System

CSharp examples for System:DateTime Year

Description

Returns first day of the year.

Demo Code

/********************************************************************
 *  FulcrumWeb RAD Framework - Fulcrum of your business             *
 *  Copyright (c) 2002-2010 FulcrumWeb, ALL RIGHTS RESERVED         *
 *                                                                  *
 *  THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      *
 *  FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        *
 *  COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       *
 *  AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  *
 *  AND PERMISSION FROM FULCRUMWEB. CONSULT THE END USER LICENSE    *
 *  AGREEMENT FOR INFORMATION ON ADDITIONAL RESTRICTIONS.           *
 ********************************************************************/
using System.Globalization;
using System;/*from   ww  w . j a va  2  s . co m*/

public class Main{
        //-------------------------------------------------------------------------
    /// <summary>
    /// Returns first day of the year.
    /// </summary>
    /// <param name="date">date to return result for</param>
    /// <returns>first day of the year</returns>
    static public DateTime GetFirstYearDay(DateTime date)
    {
      return new DateTime(date.Year, 1, 1);
    }
}

Related Tutorials