Reputation: 3
I have an Excel file exported from SAP system with date that has a format of mm.dd.yy
(example: 08.03.17
) however, I need to import the Excel file to another system that uses a VBScript and it only accepts a date format of month name dd, yyyy
(example: Aug. 03, 2017
).
I kept on searching for similar question but failed to find any solution. Please help. I do not have much knowledge with VBScript.
Upvotes: 0
Views: 1045
Reputation: 200233
SO is not a place where other people write code for you. We usually don't answer questions when the answer would entail writing the entire script for you. I'll give you some pointers, though:
Start with splitting your date string:
str = "08.03.17"
arr = Split(str, ".")
Determine the (short) month name from the month fragment:
m = MonthName(arr(0), True)
Change the year to a full year by prepending it with the string "20":
y = "20" & arr(2)
You'll need additional logic if your date values could predate the year 2000.
Rebuild the date string from the fragments:
WScript.Echo m & ". " & arr(1) & ", " & y
Upvotes: 2