GETTING MONTH AND YEAR DATE FORMAT IN VBSCRIPT

Pravesh Singh

Total Post:412

Points:2888
Posted by  Pravesh Singh
 1131  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. Vijay Shukla

    Post:100

    Points:700
    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!