c# - How can I convert this string to date? -


Im making a post with a view and getting it into a single action in the form of a string. I get the price:

Tue Feb 18 2014 00:00:00 GMT-0300 (Hora Official Dot Brasil)

Using DateTime This string is invalid, and I have successfully set it to datetime ?

Exceptions for this string are thrown because it is not the standart date / time format.

If your GMT-0300 (Hora is officially Brazilian) is stable in your string, you can use it;

  var s = "Tuesday, February 18, 2014 00:00:00 GMT-0300 (Hora Offic Dot Brasil)"; Var date = DateTime.ParseExact (S, "DMDM DD yyyy HH: mm: ss' GMT'K '(Hora Offical Dot Brasil)', Culture Info. Invent Culture); Console.WriteLine (date);  < / Pre> 

will be output;

  2/18/2014 12:00:00 am  

This is a one.

I do not think that leaving a string delimiter is a way to parse its (Hora Official Dot Brasil) section.

Take a look; < / Li>

  • For example, One st As the ring delimiter will also have to enter -0300 part of it may be a problem, but I'm not sure ..


    Comments