Parsing this kind of string into DateTime - "Friday 22nd March 2013" (C#) -
I found a large part of the text like this:
.... Recommend that there is the ability to declare a day on Friday, March 22, 2013 ..... I will have to find the dated time (Friday 22nd March 2013) and then pars Have to do. I can find it and get almost everything to get datetime I can use Trips, but gradual suffixes (St, ND, RD, th) are throwing me. When I am trying to format the format string before calling TryParse method Can I use any wildcard characters in mind with those suffixes? Or any other suggestions? Thank you! Regarding changing unwanted characters using a The following regex should work as an example: Example code Output: It should take care of most of the cases, but be sure to check it properly. regex ?
"(? & Lt; = \ d) [az] {2}" .
string date = "Friday 22 March 2013"; Var r = New Regex (@ "(? & Lt; = \ d) [a-z] {2}"); String result = R. Change (date, ""); Console.light line (datetime purse (result, culture, infographic, invertary culture));
22/03/2013 00:00:00
Comments
Post a Comment