What is the best way to parse this string?

  • Thread starter Thread starter trint
  • Start date Start date
T

trint

orderDate = ("2004-12-08 00:00:00.000");

I want it to look like this:

string aMO = ("12");
string aDY = ("08");
string aYR = ("2004");

thanks,
Trint
 
check out the System.DateTime class, it has two methods:

DateTime.Parse
DateTime.ParseExact

HTH

Ollie Riches
 
You can use orderDate.Substring(startIndex, length) to extract portions of
it...

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
 
orderDate = ("2004-12-08 00:00:00.000");
I want it to look like this:
string aMO = orderDate.SubString(5,2);
string aDY = orderDate.SubString(0,4);
string aYR = orderDate.SubString((8,2;

I hope this helps

Cor
 
Hi,

Try Substring instead and maybe a little common sense too ;)

cheers,
 
Ignacio,

I saw my error direct when I saw your message (was after sending mine),
however, had to go and thought as you wrote it in your answer
............................

Thanks,

:-)

Cor
 
Back
Top