CSharp examples for System:DateTime Calculate
Round DateTime value
using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w ww .j a v a 2 s . c o m*/ public class Main{ public static DateTime Round(this DateTime date, TimeSpan span) { long ticks = (date.Ticks + (span.Ticks / 2) + 1) / span.Ticks; return new DateTime(ticks * span.Ticks, date.Kind); } }