Get Date For First Day Of Month - CSharp System

CSharp examples for System:DateTime Day

Description

Get Date For First Day Of Month

Demo Code


using System.Globalization;
using System.Windows.Forms;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from   w  w w  .j a v  a  2s.c  o  m*/

public class Main{
        // -----------------------------------------------------------------------
        // GetDateForFirstDayOfMonth
        // -----------------------------------------------------------------------
        public static DateTime GetDateForFirstDayOfMonth(DateTime oDateTime)
        {
            DateTime dtFirstDayOfMonth = new DateTime(
                    oDateTime.Year,
                    oDateTime.Month,
                    1
                    );

            return dtFirstDayOfMonth;
        }
}

Related Tutorials