Round Down DateTime - CSharp System

CSharp examples for System:DateTime Calculate

Description

Round Down DateTime

Demo Code


using System.Configuration;
using System;//from  w  ww .  ja  va2  s .  c  o m

public class Main{
        public static DateTime RoundDown(this DateTime dateTime, int minutes)
        {
            return new DateTime(dateTime.Year, dateTime.Month,
                 dateTime.Day, dateTime.Hour, (dateTime.Minute / minutes) * minutes, 0);
        }
}

Related Tutorials