Click here to Skip to main content
15,946,158 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Friends,
I have string value is "Week 9 (or) Current week: 2/24/2013 - 3/2/2013"

But I want startdate as "2/24/2013" and EndDate as "3/2/2013" into DATETIME.

How can i convert it. Please help me.
Updated 28-Feb-13 5:54am
[no name] 28-Feb-13 9:44am    
Have you tried the DateTime.Parse or TryParse methods?

You can use Convert.ToDateTime() or the other methods mentioned by ThePhantomUpvoter.
Share this answer
try this exampal code using regex..
string input = "Week 9 (or) Current week: 2/24/2013 - 3/2/2013";
MatchCollection matches = Regex.Matches(input, @"\d{1,2}/\d{1,2}/\d{4}");
DateTime dt =DateTime.Parse(matches[0].Value);
DateTime dt2 = DateTime.Parse(matches[1].Value);

also go through following link
Regular expression - String followed by a date[^]
Share this answer
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900