Concatenating 4 fields to form a date value using VBScript

Posted on 2012-09-07
Last Modified: 2012-09-07

I am trying to concatenate 4 fields so that the dates form like this "##/##/####".

This is the current logic that parses correctly but I have some values that have single digits that need to have leading zeros so that it is in the format that I need.

DTSDestination("WAM") = DTSSource("LM_PropSaleMth") & "/" & DTSSource("LM_PropSaleDay") & "/" & DTSSource("LM_PropSaleCentury") & DTSSource("LM_PropSaleYr2Digits")


Question by:Jintonix415
    1 Comment
    LVL 92

    Accepted Solution

    DTSDestination("WAM") = Right("0" & DTSSource("LM_PropSaleMth"), 2) & "/" & _
        Right("0" & DTSSource("LM_PropSaleDay"), 2) & "/" & _
        DTSSource("LM_PropSaleCentury") & DTSSource("LM_PropSaleYr2Digits")

    Open in new window


    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now