c# 4.0 - String Conversation to DateTime -


I am facing a problem while converting strings into datetime. It does not recognize me as "string valid date time"

Here is my input string

  10/28/2014 3 : 13:12 am " 

code snippet

  datetime DT = date time. Purse AXact (" 10/28/2014 3:13:12 am "," DD-MMM-YY HH:  

I have gone through some stack overflow posts but still have the same problem.

Referral

Use this format string: "MM / dd / yyyy H: mm: ss tt" :

  datetime DT = date time. Purse AXact ("10/28/2014 3:13:12 AM", "MM / DD / YY H: Mm: ss tt", CultureInfo.InvariantCulture);  

If you want to convert the resultant DateTime with a string in this format: dd -mm-yyyy hh: mm : < / P> String result = DT. ToString ("dd-MMM-yyyy HH: mm", CultureInfo.InvariantCulture);

Culture Info.InvariantCulture emphasizes the name of the English month instead of the local name.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -