Concatenating 4 fields to form a date value using VBScript


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")


Who is Participating?
Patrick MatthewsConnect With a Mentor Commented:
DTSDestination("WAM") = Right("0" & DTSSource("LM_PropSaleMth"), 2) & "/" & _
    Right("0" & DTSSource("LM_PropSaleDay"), 2) & "/" & _
    DTSSource("LM_PropSaleCentury") & DTSSource("LM_PropSaleYr2Digits")

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.