Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONVERT DATE TO STRING

Applications

CONVERT DATE TO STRING

by  KJSDAD  Posted    (Edited  )
'****************************************************************************************************
' Function to convert a datetime field to text regardless of how you have your short date definged
' m/d/yy or mm/dd/yyyy both will work.

Public Sub CvtDatetoText()
dim dd, mm, yy, Datearray

'breakup variables check length if not right then concat...

Datearray = split(DTSSource("STATEMENT_DATE_FROM"), "/", -1)
mm = Datearray(0)
dd = Datearray(1)
yy = Datearray(2)

if len(mm) =1 then
mm = "0"+mm
end if

if len(dd) =1 then
dd = "0"+dd
end if

if len(yy) =2 then
if yy > "40" then
yy = "19"+yy
else
yy = "20"+yy
end if

end if

'Load global DTS variable
DTSGlobalVariables("DateString").Value = yy+mm+dd

End Sub

[swords]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top