CSharp examples for System:DateTime Calculate
Compare date with date now
using System.Threading.Tasks; using System.Text.RegularExpressions; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w .ja v a2s . c o m*/ public class Main{ /// <summary> /// Compare date with date now /// </summary> /// <param name="date"></param> /// <returns></returns> public static bool IsDateWithNow(DateTime date) { if (date.CompareTo(DateTime.Today) != -1) { return true; } else { return false; } } public static DateTime Today(int hour = 0, int minute = 0, int second = 0) { return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hour, minute, second, 0); } }