Results 1 to 18 of 18

Thread: Changing a String for Certain Dates

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2013
    Posts
    5

    Changing a String for Certain Dates

    Hi all,

    I am new to VB6

    My question is, I have a date in the from of MDDYYYY... I need it to be in the from o f YYMMDD.

    My program works for months that have two integers (10, 11, and 12)...but does not work for months with just one integer (1, 2, 3, 4, 5, 6, 7, 8, 9) and the reason for this, is because I need to append a 0 to the beginning for those months...

    How do I add a 0 to the months that are represented with one integer and not add it to the months that are represented with two integers?

    Thanks in advance
    Code:
        thedate = MonthView1.Value    ' Grabs date from the calender (in the form mddyyyy)
        month = Mid(thedate, 1, 1)       ' define the month 
        day = Mid(thedate, 2, 2)           ' define the day
        year = Mid(thedate, 4, 4)          ' define the year
        mod_year = Mid(year, 3, 2)       ' shorten the year from yyyy to yy            
        mod_date= mod_year & month & day
    Last edited by terh; Jan 14th, 2013 at 10:46 AM.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width