Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

format date string

Posted on 2004-10-21
2
Medium Priority
?
1,053 Views
Last Modified: 2008-02-01
I have a string  01012004  which is in format ddmmyyyy


i want to format it so it can be converted to a valide date

I'm trying but doesn't work??

strInDate = string.Format(strInDate,"{0:##/##/####}");  
strOutDate = DateTime.Parse(strInDate);

0
Comment
Question by:rourkas1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
DBright earned 1000 total points
ID: 12374938
DateTime dtInput = DateTime.ParseExact(sDate, "ddMMyyyy", System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat);
0
 
LVL 3

Expert Comment

by:nitrogenx
ID: 12375368
outDate = inDate.Substring(0, 2) + "/" + inDate.Substring(2, 2) + "/" + inDate.Substring(4);

or

outDate = DateTime.ParseExact(date, "ddMMyyyy",
         System.Globalization.CultureInfo.InvariantCulture.DateTimeFormat).ToShortDateString();
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question