Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR DART

convert string to datetime

string CurrentDate = "06/04/2020";
   
   // Creating new CultureInfo Object
   // You can use different cultures like French, Spanish etc.
   CultureInfo Culture = new CultureInfo("en-US");
   //Use of Convert.ToDateTime() 
   DateTime DateObject = Convert.ToDateTime(CurrentDate, Culture);
   Console.WriteLine("The Date is: " + DateObject.Day + " " + DateObject.Month + " " + DateObject.Year);
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #convert #string #datetime
ADD COMMENT
Topic
Name
1+1 =