Convert From Date Integer - CSharp System

CSharp examples for System:DateTime Convert

Description

Convert From Date Integer

Demo Code


using System.Text;
using System.Collections.Generic;
using System;//from  w ww  . ja v a  2s.  c o m

public class Main{
        public static DateTime ConvertFromDateInteger(int theDate, int hour, int minute, int second)
        {
            int year = theDate / 10000;
            int month = (theDate % 10000) / 100;
            int day = (theDate % 10000) % 100;

            return new DateTime(year, month, day, hour, minute, second);
        }
        #endregion

        #region ConvertFromDateInteger
        public static DateTime ConvertFromDateInteger(int theDate)
        {
            return Date.ConvertFromDateInteger(theDate, 0, 0, 0);
        }
}

Related Tutorials