Hi,
I am creating a DTS package and in one of the steps the file that is created is automatically renamed using the current data and time. The problem is that the HOUR and MINUTES are coming in as single digits and dropping the leading zero, which of course I need.
Below is the code that I am using, I've tried various methods of getting the leading zero to show up back I cannot get it.
Any help would be greatly appreciated.
Thanks,
Mitch
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim FileDate
Dim DateString
Dim FSO
Dim File
FileDate = Date
DateString = DatePart("yyyy",FileDate) & Right("0" & _
DatePart("m",FileDate), 2) & Right("0" & DatePart("d",FileDate), 2) & _
Hour(Now) & Minute(Now)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile("c:\temp\suo_test_2.txt")
File.Name = "test" & DateString & ".txt"
Main = DTSTaskExecResult_Success
End Function
I am creating a DTS package and in one of the steps the file that is created is automatically renamed using the current data and time. The problem is that the HOUR and MINUTES are coming in as single digits and dropping the leading zero, which of course I need.
Below is the code that I am using, I've tried various methods of getting the leading zero to show up back I cannot get it.
Any help would be greatly appreciated.
Thanks,
Mitch
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Dim FileDate
Dim DateString
Dim FSO
Dim File
FileDate = Date
DateString = DatePart("yyyy",FileDate) & Right("0" & _
DatePart("m",FileDate), 2) & Right("0" & DatePart("d",FileDate), 2) & _
Hour(Now) & Minute(Now)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set File = FSO.GetFile("c:\temp\suo_test_2.txt")
File.Name = "test" & DateString & ".txt"
Main = DTSTaskExecResult_Success
End Function