Give examples for Instr(),split(),join() and mid()
1) Instr(): Instr function search substring in a string. It returns the position of the substring. If substring does exits it returns position of the substring.If the substring doesnot exit it returns 0.
Syntax: InstrSplit (string, substring) Example for Instr function; 2) Split(): A split function returns an array that contains a specific number of values split based on delimiter
Syntax: Split (string, "Deliminator") Example for Split function;
3) Join(): A Function, which returns a String that contains a specified number of substrings in an array. This is an exact opposite function of Split Method.
Example for Split function; 4) Mid(): Mid function is used to extract the characters form source to destination (or) The Mid function returns a specified number of characters from a string.
Syntax: mid (string, start, length) Example for Mid function;
Syntax: InstrSplit (string, substring) Example for Instr function; 2) Split(): A split function returns an array that contains a specific number of values split based on delimiter
Syntax: Split (string, "Deliminator") Example for Split function;
3) Join(): A Function, which returns a String that contains a specified number of substrings in an array. This is an exact opposite function of Split Method.
Example for Split function; 4) Mid(): Mid function is used to extract the characters form source to destination (or) The Mid function returns a specified number of characters from a string.
Syntax: mid (string, start, length) Example for Mid function;
VB Script Date and Time Functions
Function
|
Description
|
Sample
Arguments
|
CDate(date)
|
Returns a date representation of date.
|
"jan 19, 1926"
|
Date
|
Returns the date set on the server
running IIS.
|
|
DateAdd(interval,number,datetime)
|
Adds number years to datetime.
|
"yyyy",10,Now
|
Adds number quarters to datetime.
|
"q",10,Now
|
|
Adds number months to datetime.
|
"m",10,Now
|
|
Adds number days to datetime.
|
"d",10,Now
|
|
Adds number weeks to datetime.
|
"ww",10,Now
|
|
Adds number hours to datetime.
|
"h",10,Now
|
|
Adds number seconds to datetime.
|
"s",10,Now
|
|
DateDiff(interval,startdate,enddate)
|
Returns number of years between startdate
and enddate.
|
"yyyy","12/9/1973",Now
|
Returns number of quarters between startdate
and enddate.
|
"q","3/9/1963",Now
|
|
Returns number of months between startdate
and enddate.
|
"m","3/9/1963",Now
|
|
Returns number of days between startdate
and enddate.
|
"d","3/9/1963",Now
|
|
Returns number of weeks between startdate
and enddate.
|
"ww","3/9/1963",Now
|
|
Returns number of hours between startdate
and enddate.
|
"h","3/9/1963",Now
|
|
Returns number of seconds between startdate
and enddate.
|
"s","3/9/1963",Now
|
|
DatePart(interval,date)
|
Returns the year of date.
|
"yyyy",Now
|
Returns the quarter of date.
|
"q",Now
|
|
Returns the month of date.
|
"m",Now
|
|
Returns the day of year of date.
|
"y",Now
|
|
Returns the day of month of date.
|
"d",Now
|
|
Returns the weekday of date.
|
"w",Now
|
|
Returns the week of year of date.
|
"ww",Now
|
|
Returns the hour of date.
|
"h",Now
|
|
Returns the second of date.
|
"s",Now
|
|
DateSerial(year,month,day)
|
Returns a date representation of
selected year, month, and day.
|
1975,08,25
|
DateValue(date)
|
Returns a date representation of date.
|
"Dec 29, 1939"
|
Day(date)
|
Returns the day of the month of date.
|
Date
|
FormatDateTime(datetime[,format])
|
Returns a date/time representation of
datetime with optional format.
|
Now
|
Now,vbLongDate
|
||
Now,vbShortDate
|
||
Now,vbLongTime
|
||
Now,vbShortTime
|
||
Hour(time)
|
Returns the hour of the day of time.
|
Time
|
IsDate(arg)
|
Returns True if arg is a valid
date or False if arg is not a valid date.
|
"Mar 15, 1947"
|
"Mar 35, 1947"
|
||
Minute(time)
|
Returns the minute of the hour of time.
|
Time
|
Month(date)
|
Returns the month of the year of date.
|
Date
|
MonthName(month,[abbreviate])
|
Returns the name of month number month.
|
MonthName(3)
|
Returns abbreviation of month number month.
|
MonthName(1,True)
|
|
Now
|
Returns the date and time set on the
server running IIS.
|
|
Second(time)
|
Returns the second of the minute time.
|
Time
|
Time
|
Returns the time set on the server
running IIS.
|
|
TimeSerial(hour,minute,second)
|
Returns a time representation of
selected hour, minute, and second.
|
08,44,41
|
TimeValue(time)
|
Returns a time representation of time.
|
"12:29:39"
|
Weekday(date)
|
Returns the day of the week of date.
|
Date
|
WeekdayName(date,[abbreviate])
|
Returns the name of weekday number weekday.
|
WeekdayName(5)
|
Returns abbreviation of weekday
number weekday.
|
WeekdayName(1,True)
|
|
Year(date)
|
Returns the year of date.
|
Date
|
Subscribe to:
Posts (Atom)