VBScript to convert timestamp to YYYYMMDD formatted string

I started with the code on this page.

Function FormatYYYYMMDD(timeStamp)

Dim dateMonth : dateMonth = DatePart("M", timeStamp)
Dim dateDay : dateDay = DatePart("D", timeStamp)
Dim dateYear : dateYear = DatePart("YYYY", timeStamp)
Dim dateString

dateString = dateYear

If dateMonth < 10 Then
dateString = dateString & "0" & dateMonth
Else
dateString = dateString & dateMonth
End If

If dateDay < 10 Then
dateString = dateString & "0" & dateDay
Else
dateString = dateString & dateDay
End If

FormatYYYYMMDD = dateString
End Function