DateTime

G

Guest

I have a date and time field which looks like the following:

01/Oct/2004:13:49:19

I thought I could use the DateTime.Parse(myTextDate) method to convert this
into a date and time object, but it does not like my date value. Am I using
the wrong method? Is there an easy way to get this converted into a DateTime
object?

Thanks
 
B

Brian

It's having an issue with the colon between the date and the time.

Try "01/Oct2004 13:49:19" and it will work.

--Brian
 
B

Brian

Or, you can use the DateTime.ParseExact() method:


DateTime.ParseExact("01/Oct/2004:13:49:19", "dd/MMM/yyyy:HH:mm:ss", null);

That will work also...

--Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top