CSharp examples for System:DateTime Day
Gets the start time of yesterday
using System.Globalization; using System;/* w ww .j a v a2s. c o m*/ public class Main{ /// <summary> /// Gets the start time of yesterday /// </summary> public static DateTime Yesterday(this DateTime dateTime) { return dateTime.AddDays(-1).StartOfDay(); } /// <summary> /// Returns the FIRST possible time unit for provided DAY in dateTime /// (Same as DateTime.Date) /// </summary> public static DateTime StartOfDay(this DateTime dateTime) { return dateTime.Date; } }