VBScript Functions - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

VBScript Functions

Description:

DateDiff(date1,date2) -- returns number of days difference ... Int(x) -- truncates beyond decimal point. Round(x) -- rounds to nearest whole number ... – PowerPoint PPT presentation

Number of Views:327
Avg rating:3.0/5.0
Slides: 8
Provided by: Econ82
Category:

less

Transcript and Presenter's Notes

Title: VBScript Functions


1
VBScript Functions Subroutines
  • MIS 3353 -- Web Site Development

2
Functions, Subroutines, Arguments
  • Arguments are the values brought into and used in
    the subprogram
  • Syntax for calls
  • Functions
  • FunctionName(arg1,arg2, . . .)
  • FunctionName
  • Subroutines
  • SubroutineName arg1, arg2, . . .
  • SubroutineName

3
Intrinsic Functions
  • Date Time
  • String Manipulation
  • Numeric
  • Other

4
Date Time Functions
  • Time
  • Date
  • Now -- returns both date and time
  • Day(date)
  • Month(date)
  • Year(date)
  • Weekday(date)
  • WeekdayName(number)
  • MonthName (number)
  • DateDiff(date1,date2) -- returns number of days
    difference
  • DateAdd(date,number) -- returns new date

5
String Manipulation Functions
  • Instr(search,target)
  • Len(string)
  • LCase(string) -- converts case
  • LTrim(string) -- trims blanks
  • Trim(string)
  • Space(n) -- returns n spaces
  • String(n,character) -- returns n characters
  • Left(string,n) -- returns left n characters
  • Mid(string,x,n) -- returns n characters starting
    at x

6
Math Functions
  • Rnd -- needs to be preceded by call to Randomize
  • Int(x) -- truncates beyond decimal point
  • Round(x) -- rounds to nearest whole number

7
Writing Functions Subroutines
  • Functions
  • Function FunctionName(arg1,arg2, . . . )
  • . . .
  • End Function
  • Subroutines
  • Sub SubroutineName(arg1, arg2, . . . )
  • . . .
  • End Sub
Write a Comment
User Comments (0)
About PowerShow.com