Getting month and year date format in vbscript

Total Post:412

Points:2888

 1690  View(s)
Ratings:
Rate this:
Hi,

Can someone please tell me how can we get data in the month and date format.In the below code it shows me the year with the same date one year ago in the format 6/18/2012 ..but I just need the month/year.

LastMonth = DateAdd("m",-12,Date)

Thanks

  1. Re: Getting month and year date format in vbscript

    Hi Expert!


    Use the specialized functions Month(), Year(), ... to get at the private parts of a (variable of type) Date:

    dt = DateAdd("m",-12,Date)
    WScript.Echo TypeName(dt), CStr(dt), Month(dt) & "/" & Year(dt)

    Date 6/18/2012 6/2012

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.