How do I grab the month and day using VBScript?
If I do date it returns 04/01/2004
If I do Month(Now) & "/" & Day(Date)
it returns 4/1
I need it to look like 04/01
Any ideas?
Thanks
Printable View
How do I grab the month and day using VBScript?
If I do date it returns 04/01/2004
If I do Month(Now) & "/" & Day(Date)
it returns 4/1
I need it to look like 04/01
Any ideas?
Thanks
I got it!!!
This may be the long way but this is what I did..
Code:Dim myDate
myDate = Date()
Dim enDate
Dim MyString, MyArray, Msg
MyString = myDate
MyArray = Split(MyString, "/", -1, 1)
' MyArray(0) contains "Month".
' MyArray(1) contains "Day".
' MyArray(2) contains "Year".
If MyArray(0) =< "9" then
MyArray(0) = "0" & MyArray(0)
End if
If MyArray(1) =< "9" then
MyArray(1) = "0" & MyArray(1)
End if
enDate = MyArray(0) & "/" & MyArray(1)
MsgBox enDate