Get Align Seconds Date Time - CSharp System

CSharp examples for System:DateTime Second

Description

Get Align Seconds Date Time

Demo Code


using System.Globalization;
using System.IO;/*www  .j a  v a 2  s .  co m*/
using System;

public class Main{
        public static DateTime GetAlignSecondsDateTime(DateTime time, long alignSeconds)
        {
            long ticks = time.Ticks;
            ticks -= ticks % (10000 * 1000 * alignSeconds);
            DateTime dt = new DateTime(ticks);
            return dt;
        }
}

Related Tutorials