From what I can collect from the question, it looks like the Filedate value is just a string representation of the date ( mmddyyyyhhnnss ), with this in mind, a quick test was done to see if I could parse it into the required format.
There are other ways to approach this, for example, using the RegExp object to create a list of matches, and then use them to build the output.
It is worth noting that this example will only work if the structured string is always in the same order and the same number of characters.
Function ParseTimeStamp(ts) Dim df(5), bk, ds, i 'Holds the map to show how the string breaks down, each element 'is the length of the given part of the timestamp. bk = Array(2,2,4,2,2,2) pos = 1 For i = 0 To UBound(bk) df(i) = Mid(ts, pos, bk(i)) pos = pos + bk(i) Next 'Once we have all the parts stitch them back together. 'Use the mm/dd/yyyy hh:nn:ss format ds = df(0) & "/" & df(1) & "/" & df(2) & " " & df(3) & ":" & df(4) & ":" & df(5) ParseTimeStamp = ds End Function Dim Filedate, parsedDate Filedate = "10212015140108" parsedDate = ParseTimeStamp(FileDate) WScript.Echo parsedDate
Output:
10/21/2015 14:01:08
Lankymart
source share