Click here to Skip to main content
15,905,419 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i need help converting 3 different date and time strings into one. See i load each item from a file into a datagridview so each line might have one of the following date and time formats

1.2011-10-20T20:49:59-0400
2.20:49 10/20/2011
3.June 15, 2009 8:45:30 PM

i wasn't the one in charge of maintaining these file and i wish i was but now i m in charge of creating a display that will uniform everything when users are looking through the datagrid view and see the time and date. I know how to convert one string but i need help coming up with a way that when its loading the information if its sees the date format then it knows to convert it to a specific format. I want the output to look like: 4/10/2008 6:30:00 AM, help would be great because i m lost.
Posted
Comments
Jim Jos 24-May-12 20:12pm    
Have you used ValueConverters? I think that is the best thing to do here..

1 solution

 
Share this answer
 
v2
Comments
Zachary.shupp 24-May-12 21:03pm    
i read through what you have posted and it all refreces wpf and this is a winforms application. if you think it will work with winforms could you provide an example
Jim Jos 25-May-12 0:50am    
How are you loading into Datagirdview? Using Datasource property or loading one by one?
Zachary.shupp 25-May-12 9:19am    
loading one by one. i tried using and if statement to change them but it didnt work.

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