Add seconds to current time : DateTime : Date Time C# Examples


C# Examples » Date Time » DateTime »

 

Add seconds to current time









    
using  System;
using  System.Collections.Generic;
using  System.ComponentModel;
using  System.Data;
using  System.Drawing;

public  class  MainClass{
      public  static  void  Main(){
                DateTime  endTime  =  DateTime.Now.AddSeconds(123);
                while  (DateTime.Now  <  endTime)
                {
                        Console.WriteLine(DateTime.Now.TimeOfDay.ToString());
                }
      }
}
    
   
  
   



Output

14:25:59.9687500
14:25:59.9687500
14:25:59.9687500
14:25:59.9687500
14:25:59.9687500
14:25:59.9687500
14:25:59.9687500
^CTerminate batch job (Y/N)? n


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» DateTime