Flooring DateTime - CSharp System

CSharp examples for System:DateTime Calculate

Description

Flooring DateTime

Demo Code


using System.Collections.Generic;
using System;//from   w w  w.j  av  a  2 s.c o m

public class Main{
        public static DateTime Floor(this DateTime date, TimeSpan span)
        {
            long ticks = date.Ticks / span.Ticks;
            return new DateTime(ticks * span.Ticks);
        }
}

Related Tutorials