Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:55:13+00:00 2026-06-12T15:55:13+00:00

Can someone help me to format this. in my textbox (The date is 10222012)

  • 0

Can someone help me to format this.
in my textbox (The date is 10222012)

the output should be (The date is 10/22/2012)
the text should be still there
thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T15:55:15+00:00Added an answer on June 12, 2026 at 3:55 pm

    A couple of approaches off the top of my head.

    If the text is coming from one variable, for example:

    Dim MyText As String = "The date is 10222012"
    

    Then you can use String functions to get the date (assuming it is always 8 characters, which can be a dangerous assumption), format it and stick it back in:

    Dim MyDate As String = CType(MyText.Substring(MyText.Length - 8), DateTime).ToString("MM/dd/yyyy")
    
    MyText = MyText.Substring(0, MyText.Length - 8) & MyDate
    

    If on the other hand the date is in a separate variable, say a DateTime variable, you can do this:

    Dim MyDateFormatted As String = MyDate.ToString("MM/dd/yyyy")
    

    There are other ways to do this. The key here is to get the date and convert it to the format you want via the DateTime.ToString Method (String) method, where the format string in the parantheses tells what format to use.

    EDITED

    That’s what I get for not trying the code out first…if the string “10222012” isn’t recognized as a valid format, there’s another way to do this:

    Dim MyText As String = dRecord.Rows(i).Item(iCount).ToString 
    Dim MyDate As String = MyText.Substring(MyText.Length - 8)
    MyDate  = MyDate.SubString(0, 2) & "/" & MyDate.Substring(2, 2) & "/" & _
              MyDate.Substring(4)
    oSheet.Cells(x, iCount - 2) = MyText.Substring(0, _
                                  dRecord.Rows(i).Item(iCount).Length - 8) & _
                                  MyDate
    

    It’s a bit more brute force and ugly, but that should get you going in the right direction. You might be able to get the same result use Insert (another String operator), but that might be just as ugly.

    If you need to do this conversion a lot, I recommend putting it into a helper method, or better yet an extension method.

    2nd Edit

    You can check for blank record easily enough:

    Dim MyText As String = dRecord.Rows(i).Item(iCount).ToString
    If Not String.IsNullOrEmpty(MyText) Then
        ' convert the format here
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a regex to match this format: B001169875 Can someone help
Can someone help me understand how to write this case statement properly its not
Can someone help my regex-challenged self with this? The match must start with *.
Can someone help me to tweak this regex?? I have this regex for twitter
I am hoping that someone can help me to make this match non greedy...
I hope someone can help me! I'm getting this error when sending OSC messages:
In my application I want to display the date in this format: 21st Aug,2012
Can someone help to edit this RecordSelectionFormula ? It's giving an error, something with
Can someone help me achieve multiple zend pagination in a view using ajax. I
Can someone help by showing me how to sort a LINQ expression. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.