Returns a datetime for the DateTime passed to it which will be set to tomorrow's date and with zeroed time information - CSharp System

CSharp examples for System:DateTime Format

Description

Returns a datetime for the DateTime passed to it which will be set to tomorrow's date and with zeroed time information

Demo Code


using System.Globalization;
using System.Windows.Forms;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/* w w w  .  ja  va2  s.com*/

public class Main{
        // ------------------------------------------------------------------------------------
        // ThisHour
        // Returns a datetime for the DateTime passed to it which will be set to tomorrow's date
        // and  with zeroed time information.
        // ------------------------------------------------------------------------------------
        public static DateTime ThisHourTomorrow(DateTime oDateTime)
        {
            DateTime oNewDateTime = new DateTime(
                    oDateTime.Year,
                    oDateTime.Month,
                    oDateTime.Day,
                    oDateTime.Hour,
                    0,
                    0
                    );

            oNewDateTime = oNewDateTime.AddDays(1);

            return oNewDateTime;
        }
}

Related Tutorials