Cambiar formato de la fecha
Publicado por Javier (5 intervenciones) el 21/09/2010 13:52:26
Como cambio este scrpts para que me deje la fecha en el siguiente formato:
20100915105238
'Declaración de las variables
Dim objFileSystem, objOutputFile, strOutputFile,WshShl, Shell, DayOfYear, vararcserve
'Definicion de los objetos
Set WshShl = WScript.CreateObject("WScript.Shell")
Set Shell = WshShl.Environment("user")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Aquí definimos las variables de VMware que queremos incluir en el fichero
vararcserve = WshShl.ExpandEnvironmentStrings(("%COMPUTERNAME% ") & "Todas las sesiones Migradas.")
'En ésta variable guardamos el día actual en formato ordinal
DayOfYear = Round(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)
'Cleanup Objects
Set WshShl = Nothing
Set Shell = Nothing
'Creamos la carpeta destino si no existe.
If objFSO.FolderExists("E:\Logs_Aplicaciones") Then
Set objFolder = objFSO.GetFolder("E:\Logs_Aplicaciones")
Else
Set objFolder = objFSO.CreateFolder("E:\Logs_Aplicaciones")
End If
'Generamos el fichero de salida con el formato del log único.
strOutputFile = "E:\Logs_Aplicaciones\APL_"&DayOfYear&".log"
Set objOutputFile = objFileSystem.OpenTextFile(strOutputFile,8,TRUE)
objOutputFile.WriteLine(Now & " | " & "9V" & " | " & "ES_0000" & " | " & "000000" & " | " & "0000000000" &" | " & "A" & " | " & vararcserve )
objOutputFile.Close
Set objFileSystem = Nothing
'Salimos
WScript.Quit(0)
20100915105238
'Declaración de las variables
Dim objFileSystem, objOutputFile, strOutputFile,WshShl, Shell, DayOfYear, vararcserve
'Definicion de los objetos
Set WshShl = WScript.CreateObject("WScript.Shell")
Set Shell = WshShl.Environment("user")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Aquí definimos las variables de VMware que queremos incluir en el fichero
vararcserve = WshShl.ExpandEnvironmentStrings(("%COMPUTERNAME% ") & "Todas las sesiones Migradas.")
'En ésta variable guardamos el día actual en formato ordinal
DayOfYear = Round(((Now / 365.255) - (Year(Now) - 1900)) * 365.255)
'Cleanup Objects
Set WshShl = Nothing
Set Shell = Nothing
'Creamos la carpeta destino si no existe.
If objFSO.FolderExists("E:\Logs_Aplicaciones") Then
Set objFolder = objFSO.GetFolder("E:\Logs_Aplicaciones")
Else
Set objFolder = objFSO.CreateFolder("E:\Logs_Aplicaciones")
End If
'Generamos el fichero de salida con el formato del log único.
strOutputFile = "E:\Logs_Aplicaciones\APL_"&DayOfYear&".log"
Set objOutputFile = objFileSystem.OpenTextFile(strOutputFile,8,TRUE)
objOutputFile.WriteLine(Now & " | " & "9V" & " | " & "ES_0000" & " | " & "000000" & " | " & "0000000000" &" | " & "A" & " | " & vararcserve )
objOutputFile.Close
Set objFileSystem = Nothing
'Salimos
WScript.Quit(0)
Valora esta pregunta


0