Use the Parse() method to convert strings to DateTime instances : DateTime Parse ParseExact : Date Time C# Examples


C# Examples » Date Time » DateTime Parse ParseExact »

 

Use the Parse() method to convert strings to DateTime instances









    
using  System;

class  MainClass
{
    public  static  void  Main()
    {

        
        DateTime  myDateTime5  =  DateTime.Parse("1/11/2004  23:10:30");

        Console.WriteLine("myDateTime5  =  "  +  myDateTime5);
    }

}
    
   
  
   



Output

myDateTime5 = 01/11/2004 11:10:30 PM


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» DateTime Parse ParseExact