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");

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

}
    
   
  
   



Output

myDateTime5 = 01/11/2004 12:00:00 AM


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» DateTime Parse ParseExact