Ceiling DateTime - CSharp System

CSharp examples for System:DateTime Calculate

Description

Ceiling DateTime

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from w w w  .  j  ava  2  s .  com

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

Related Tutorials