Last friday's date using VbScript



Some vbscript to get the previous week's date, modify the code and you can do a lot of fun things with the same:

'Gets the last friday's date
 strCurrentSysDate = Date
 strModDate = dateadd("ww",-1,strCurrentSysDate)
 numWeekDay = 6- weekday(strModDate)
 strModifiedDate = dateadd("d",numWeekDay,strModDate)
 strmonth =left(monthname(month(strModifiedDate)),3)
 If len(cstr(day(strModifiedDate))) < 2 Then
  strDate = "0"&day(strModifiedDate)
 else
  strDate = day(strModifiedDate)
 End If
 strYear = year(strModifiedDate)

 strPrevDate =  strmonth& "/" & strDate & "/" & strYear
Msgbox strPrevDate

Comments

  1. Hi,

    Technology Specific Guide for QTP is a new book that has got great feedback from all the readers. It will get you started on the path of automation, introducing solutions, roadblocks, patches and ideas that will give you a solid foundation in the field of automation. Everyone from a novice user to an automation expert will have something they would have never heard of or used.

    http://bluemagic-automation.blogspot.in/

    Best Regards,
    Aditya.

    ReplyDelete

Post a Comment

Popular posts from this blog

XPATH for IE / internet explorer

All time good software testing books!