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

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?