Archive for the ‘Sample Code – Functions’ Category


Demo String Functions

‘================================================================= ‘ NAME: StringFunctions1.vbs ‘ Authors: Neal Walters ‘ http://VBScript-Training.com ‘================================================================= text1 = “We the people of the United States, in order to form the a more perfect union…” ‘ 1…5…10….5…20.. WScript.Echo “Text1=” & text1 WScript.Echo “Length=” & Len(text1) WScript.Echo “Left(text1,2)=” & Left(text1,2) WScript.Echo “Right(text1,8)=” & Right(text1,8) WScript.Echo “Mid(text1,8,6)=” & Mid(text1,8,6) WScript.Echo “InStr(text1,”"United”")=” & InStr(text1,”United”) [...]

Read More...

Selected Date/Time Functions

‘================================================================= ‘ NAME: DateTimeFunctions4.vbs – DateDiff ‘================================================================= Date1 = #12/31/2005# Date2 = #12/25/2005# WScript.Echo “Date1=” & Date1 WScript.Echo “Date2=” & Date2 WScript.Echo “Number of days between = ” & DateDiff(“d”,date1,date2) Date1 = #12/20/1900# Date2 = #12/25/1950# WScript.Echo “Date1=” & Date1 WScript.Echo “Date2=” & Date2 WScript.Echo “Number of years between = ” & DateDiff(“yyyy”,date1,date2) ‘================================================================= ‘ [...]

Read More...