using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
///
/// Contains extension methods.
///
public static class DateTimeExtensions
{
///
/// Converts the DateTime instance to an accurate time string.
///
/// The date.
///
public static String ToTimeString(this DateTime date)
{
return date.ToString("HH:mm:ss.ff");
}
///
/// Returns a string which can be used as a file name.
///
/// The date.
///
public static String ToFileName(this DateTime date)
{
return string.Format("{0:dd-MM-yyyy HH-mm-ss}", DateTime.Now);
}
///
/// Determines whether the date between start and end.
///
/// The this date time.
/// The start.
/// The end.
///
/// true if the date between start and end; otherwise, false.
///
public static bool IsBetween(this DateTime thisDateTime, DateTime start, DateTime end)
{
return thisDateTime >= start && thisDateTime <= end;
}
}