[RESOLVED] how to convert a string to date format?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: [RESOLVED] how to convert a string to date format?

  1. #1
    Join Date
    May 2012
    Posts
    8

    [RESOLVED] how to convert a string to date format?

    Hi All,

    I have a string like this '20051022'(YYYYMMDD). I want to convert into '10/22/2005'(MM/DD/YYYY). Can anybody suggest on this?

    Thanks in advance

  2. #2
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,006

    Re: how to convert a string to date format?

    Code:
    string initial = "20051022";
    string final = initial.substring(4,2) + "/" + initial.substring(6,2) + "/" + initial.substring(0, 4);
    Learn more about string operations by reading this tutorial: http://www.techotopia.com/index.php/...ngs_in_C_Sharp
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  3. #3
    Join Date
    May 2012
    Posts
    8

    Re: how to convert a string to date format?

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center