Date Conversion

  • Thread starter Thread starter Phil H
  • Start date Start date
P

Phil H

I have a string variable "1/2/2007". What is the easiest way to convert it
to "20070102". In VB6, I could cat it to to date and format. Is there equiv
C# code to do that. I don't want to do any string manuipulation.
Thanks
 
Phil,

The Class Library should be the exact same in C# as in VB6 (they are
both using the same assemblies).

DateTime.Parse("1/2/2007").ToString("yyyMMdd")

-James
 
One little addition, when using the
convert.todatetime(string) = can enter ISO Date format as well as the
default for the location.

ISO = YYYY/MM/DD; for america MM/DD/YYYY; and most others :) DD/MM/YYYY
 

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


Back
Top