2
I have a code that works, but I need help with the date format. On the conversion of xls to csv converts the date to mm/dd/yyyy and time to h:mm and I wanted it to be dd-mm-yyyy and the time to hh:mm. What I need in my code?
example of the conversion date and time: 5/28/2018 0:15 and I needed you to do so: 28-05-2018 00:15
if WScript.Arguments.Count < 2 Then
WScript.Echo "Please specify the source and the destination files. Usage: ExcelToCsv <xls/xlsx source file> <csv destination file>"
Wscript.Quit
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
src_file = objFSO.GetAbsolutePathName(Wscript.Arguments.Item(0))
dest_file = objFSO.GetAbsolutePathName(WScript.Arguments.Item(1))
Dim oExcel
Set oExcel = CreateObject("Excel.Application")
Dim oBook
Set oBook = oExcel.Workbooks.Open(src_file)
oBook.SaveAs dest_file, 3
oBook.Close False
oExcel.Quit
Set objFile = objFSO.OpenTextFile(dest_file, 1)
strText = objFile.ReadAll
objFile.Close
strNewText = Replace(strText, " ", ";")
Set objFile = objFSO.OpenTextFile(dest_file, 2)
objFile.WriteLine strNewText
objFile.Close
It is using the Date/Time format configured in the computer control panel?
– Tony