CSharp examples for System:DateTime Calculate
Returns true if the date is between or equal to one of the two values.
using System;/*from ww w .j a v a 2s .c o m*/ public class Main{ /// <summary> /// Returns true if the date is between or equal to one of the two values. /// </summary> /// <param name="date">DateTime Base, from where the calculation will be preformed.</param> /// <param name="startvalue">Start date to check for</param> /// <param name="endvalue">End date to check for</param> /// <returns>boolean value indicating if the date is between or equal to one of the two values</returns> public static bool Between(this DateTime date, DateTime startDate, DateTime endDate) { var ticks = date.Ticks; return ticks >= startDate.Ticks && ticks <= endDate.Ticks; } }