Change DateTime Seconds - CSharp System

CSharp examples for System:DateTime Second

Description

Change DateTime Seconds

Demo Code


using System.Collections.Generic;
using System;/*from  w  ww.  j  a  v a  2  s.com*/

public class Main{
        public static DateTime ChangeSeconds(this DateTime dateTime, int seconds, int milliseconds)
        {
            return new DateTime(
                dateTime.Year,
                dateTime.Month,
                dateTime.Day,
                dateTime.Hour,
                dateTime.Minute,
                seconds,
                milliseconds,
                dateTime.Kind);
        }
}

Related Tutorials