CSharp examples for System:DateTime Quarter
Round Down To Quarter Hour
using Windows.Globalization.DateTimeFormatting; using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from www. j a v a 2 s . c o m*/ public class Main{ public static DateTime RoundDownToQuarterHour(this DateTime dateTime) { var newMinute = dateTime.Minute - (dateTime.Minute % 15); return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0, 0, dateTime.Kind).AddMinutes(newMinute); } }