We help IT Professionals succeed at work.
Get Started

Changing Text into Date in VB

306 Views
Last Modified: 2012-05-12
I have a series of column headings which are used to describe a date period, however they are stored as a number.


PERIOD1      PERIOD2      PERIOD3      PERIOD4      PERIOD5      PERIOD6      PERIOD7      PERIOD8
9042011      9302011      10072011      11142011      11212011      11282011      12052011      12122011

PERIOD1 is Cell "F1" and the date range is "F2:BE2"

I need to convert these into a MS Date format.  I am thinking that if I were to get the slash marks in the right spots (9/04/2011), the program will easily convert this into a date during a second import process. I thought that I might need to read the numbers and set them as temp variables tvDate = (4 characters from right), tvDay = (2 characters in mid) and tvMonth = (first 1 or 2 characters).

Then put all the temp values together again as a date formated "mm/dd/yyyy" and replace the field.

Any thoughts on this?

Comment
Watch Question
Most Valuable Expert 2012
Top Expert 2012
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE