Results 1 to 2 of 2

Thread: Convert string to date in VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2009
    Posts
    11

    Convert string to date in VB6

    Hi all,

    I am very new to VB6 and have something I can't seem to figure out. Help would be greatly appreciated!!!!

    I have a field stored in the database as varchar6 in the yyyymm format. I need to add 18 months to this date and display the results on a vb6 form. Can someone help me with the code to do this?

    Thank you in advance for you help.
    Christine

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Convert string to date in VB6

    VB's DateSerial can do the trick, using Left 4 chars as the year, Right 2 chars as the month, then supply 1 for the day. Use VB's DateAdd() function to add to a date variable as desired.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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