Convert this to integer - CSharp System

CSharp examples for System:DateTime Convert

Description

Convert this to integer

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from   w w w  .ja v a 2  s.c  om*/

public class Main{
        /// <summary>
        /// Convert this to integer
        /// </summary>
        /// <param name="date">this date to convert</param>
        /// <returns>this as YYYYMMDD</returns>
        public static int ToInt(this DateTime date)
        {
            return (date.Year * 100 + date.Month) * 100 + date.Day;
        }
}

Related Tutorials