Trim Seconds And Milliseconds - CSharp System

CSharp examples for System:DateTime Second

Description

Trim Seconds And Milliseconds

Demo Code


using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;/*from w ww .j  a va  2  s  .c om*/

public class Main{
        public static DateTime TrimSecondsAndMilliseconds(this DateTime self) {
         var dt = new DateTime(self.Year, self.Month, self.Day, self.Hour, self.Minute, 0, 0);
         dt = DateTime.SpecifyKind(dt, self.Kind);
         return dt;
      }
}

Related Tutorials