Get current time : DateTime Now : Date Time C# Examples


C# Examples » Date Time » DateTime Now »

 

Get current time









    
using  System;    
    
class  MainClass  {    
    public  static  void  Main()  {    
        string  t;  
        int  seconds;  
  
        DateTime  dt  =  DateTime.Now;  
        seconds  =  dt.Second;  
  
        //  update  time  if  seconds  change  
        if(seconds  !=  dt.Second)  {  
            seconds  =  dt.Second;  
  
            t  =  dt.ToString("T");  
            Console.WriteLine(t);  
        }  
    }  
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» DateTime Now