Results 1 to 2 of 2

Thread: Month/Day

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Dallas Texas
    Posts
    28

    Month/Day

    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

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Location
    Dallas Texas
    Posts
    28
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width