Register Blogs FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "VBScript Functions Reference" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). Visit the ASP Development forum for help with ASP/VBScript and ASP/JScript applications.


Closed Thread
 
LinkBack Thread Tools Display Modes
  #11  
Old March 23rd, 2008, 05:24 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default Chr

Syntax: Chr(ANSIvalue)

The Chr function converts an ANSI character code value to a character.

Example(s):
Code:
This will output b
<% =Chr(98) %> 
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

If you like it here...throw us a few bones to help
support us.

Join our Folding team: DeveloperBarn Folding

Sponsored Links
  #12  
Old March 23rd, 2008, 05:27 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default CInt

Syntax: CInt(number)

The CInt function converts any number to the variant of subtype Integer.

Converts to values ranging from -32,768 to 32,767

Example(s):
Code:
This will output 1235 (rounded off)
<% anynumber=1234.567 %> 
<% =CInt(anynumber) %>
  #13  
Old March 23rd, 2008, 05:37 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default CLng

Syntax: CLng(number)

The CLng function converts any number to the variant of subtype Long, with floating-point numbers rounded.

Converts to integers ranging from -2,147,483,648 to 2,147,483,647.

Example(s):
Code:
This will ouput 1235
<% anynumber=1234.6 %> 
<% =CLng(anynumber) %>
  #14  
Old March 23rd, 2008, 05:41 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default Cos

Syntax: Cos(number)

The Cos function returns the cosine for a number (angle).

Example(s):
Code:
This will output 0.52532198881773
<% =Cos(45.0) %>
 
This will output 0.52532198881773
<% =Cos(-45.0) %>
  #15  
Old March 23rd, 2008, 05:53 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default CreateObject

Syntax: CreateObject(ServerName.TypeName, RemoteServerName)

ServerName is the name of the application that provides the object. TypeName is the type (class) of the object to be created.
The optional RemoteServerName argument was added in verson 5.0 and is used to create an object on a remote server. It is the name of the remote server. To use this argument, the internet security must be turned off.

The CreateObject function is used to create an object of the type specified in the argument.

The Set statement assigns the object reference to a variable or property. The keyword Nothing is used to unassign the object reference from the variable or property. Good programming techniques require that you unassign all objects before you exit the program.

Example(s):
Code:
Creating an instance of Micrsoft Word
<% 
Set objWrd = CreateObject("Word.Application") 
... 
' Place any code you desire here 
... 
Set objWrd = Nothing 
%>
 
Creating an object on a remote site
<% 
Set objFarAway = CreateObject("Word.Application", 
"FarAwayServerName") 
... 
' Place any code you desire here 
... 
Set objFarAway = Nothing 
%>
  #16  
Old March 23rd, 2008, 05:56 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default CSng

Syntax: CSng(number)

The CSng function converts any number to the variant of subtype Single.

Converts to values ranging from -3.402823E38 to -1.401298E-45 for negative values and 1.401298E-45 to 3.402823E38 for positive values.

Example(s):
Code:
This will output 5678.123
<% anynumber=5678.123 %> 
<% =CSng(anynumber) %>
  #17  
Old March 23rd, 2008, 05:58 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default CStr

Syntax: CStr(Expression)

The CStr function converts an expression into a variant of subtype String.

If the expression is Boolean, the output is a string containing either true or false. If the expression is a Date, the output is a string using the short-date format. If the expression is empty, the output is a zero length string. If the expression is an error, the output is a string with the word error followed by the error number. If the expression is numeric, the output string contains the number. If the expression is Null (does not exist), the output is a runtime error.

Example(s):
Code:
This will output 5678
<% anyexpression=5678 %> 
<% =CStr(anyexpression) %>
  #18  
Old March 23rd, 2008, 06:00 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default Date

Syntax: Date

The Date function returns the current date as determined by your computer system.

Historically, a two-digit year (MM/DD/YY) was returned. However, courtesy of the millennium, a four-digit year is now returned (MM/DD/YYYY). The same applies to the DateValue function.

Example(s):
Code:
This will output the current date
<% =Date %>
  #19  
Old March 23rd, 2008, 06:28 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default DateAdd

Syntax: DateAdd(Interval, Number, Date)

Interval - The Interval argument defines the the type of time interval you wish to add onto the date.

You must place the setting inside double quotes.
Number - The Number argument is a multiplier for the Interval argument (i.e., how many days, weeks, months, etc.). If this is a positive number, you will go forward in time. A negative number will go back in time. Date - The Date argument is a date or time.

Possible interval settings:
YYYY -Year
Q - Quarter
M - Month
Y - Day Of Year
D - Day
W - WeekDay
WW - Week Of Year
H - Hour
N - Minute
S - Second

Example(s):
Code:
This will ouput 3/16/99 4/27/99
<% =Date %> 
<% =DateAdd("WW", 6, Date) %>
 
This will output 3/16/99 12:14:00 PM 3/16/99 12:14:30 PM
<% =Now %> 
<% =DateAdd("S", 30, Now) %>
 
This will output 1/1/2001 1/1/3001
<% ="1/1/2001" %> 
<% =DateAdd("YYYY", 1000, "1/1/2001") %>
  #20  
Old March 26th, 2008, 09:32 PM
jmurrayhead's Avatar
The Barnfather
 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 951
Thanks: 22
Thanked 93 Times in 90 Posts
Blog Entries: 6
Rep Power: 4
jmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the roughjmurrayhead is a jewel in the rough

Awards Showcase
Microsoft Windows Microsoft SQL Server Microsoft .Net Classic ASP 
Total Awards: 4

Default DateDiff

Syntax: DateDiff(Interval, Date1, Date2, FirstDayofWeek, FirstWeekofYear)

Interval - The Interval argument defines the the type of time interval you wish to calculate the time difference.

You must place the setting inside double quotes.

Date1 - The Date1 argument is the first date.
Date2 - The Date2 arguments is the second date.
FirstDayofWeek - The FirstDayofWeek argument must only use the constants and values found below.
FirstWeekofYear - The FirstWeekofYear argument must only use the constants and values found below.

The DateDiff function calculates the amount of time between two different dates.

Possible interval settings:
YYYY -Year
Q - Quarter
M - Month
Y - Day Of Year
D - Day
W - WeekDay
WW - Week Of Year
H - Hour
N - Minute
S - Second

Date and Time Constants (constant - value - description):
VBSunday-1-Sunday
VBMonday-2-Monday
VBTuesday-3-Tuesday
VBWednesday-4-Wednesday
VBThursday-5-Thursday
VBFriday-6-Friday
VBSaturday-7-Saturday
VBFirstJan1-1-Week of January 1
VBFirstFourDays-2-First week of the year that has at least four days
VBFirstFullWeek-3-First full week of the year
VBUseSystem-0-Use the date format of the computer's regionsl settings
VBUseSystemDayOfWeek-0-Use the first full day of the week as defined by the system settings

Example(s):

Code:
Code:
This will ouput 291
<%=DateDiff("d", Date, "1/1/2000") %>
 
This will output -3130748108
<% olddate = #6/26/43# %> 
<% nowdate = Now %> 
<% =DateDiff("s", nowdate, olddate) %>
 
This will output 93
<% =DateDiff("w", Date, "1/1/2001", 3) %>
 
This will output 94
<% =DateDiff("ww", Date, "1/1/2001", 1, VBFIRSTFOURDAYS)%>
Closed Thread

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -4. The time now is 09:23 AM.



Content Relevant URLs by vBSEO 3.2.0