c# - Converting a string to DateTime object -


I want to convert a string to a dateTime in a specific format.

My specific string format is " dd-mm-yyyy ".

I can not manipulate any string.

This is the right code for me now:

  datetime conversion date = date time.pan (string input);  

It looks like you want a static method, from which you specify the actual date-time Can format

var changed date = date time. Purse aux (input, "dd-mm-yyyy", blank);

(Based on context, you can specify null as the argument, instead of CultureInfo.InvariantCulture instead of the current culture. )


Comments