Home / code / asp

Functions,

Conversion of datatypes

Here are some of the most importand functions. Of course you can always create your own one.

number1=Abs(number2) Absolute value of number2
number=Asc(string) ASCII value of the first character of the string
number=AscB(byte) ASCII value of the byte
number=AscW(string) Unicode value of the first character
string=Chr(number) Opposide of Asc
byte=ChrB(number) Opposide of AscB
string=ChrW(number) Opposide of AscW
CBool Conversion to the datatype Boolean
CByte Conversion to the datatype byte
CCur Conversion to the datatype currency
CDate Conversion to the datatype date
CDbl Conversion to the datatype double
CInt Conversion to the datatype integer
CLng Conversion to the datatype long
CSng Conversion to the datatype single
CStr Conversion to the datatype string
DateSerial Conversion of a serial number to the type date
DateValue Conversion of a date to a serial number
Hex Conversion of a number to a hexadecimal value in string format
Oct Convert a number to the octal value in string format
Fix Gives the whole number of a real number (219,9 becomes 219)
Int Gives the whole number of a real number
Sgn Gives the sign of a number positive or negative
TimeSerial Conversion of a serial number to the type date (HH:MM:SS)
TimeValue Convert the time in a serial number

String functions

Len(string) Calculates the length of a string
len("abcdef") --> 6
Left(string,number) Gives the first number of characters
left("abcdef",2) --> "abc"
Right(string,number) Gives the last number of characters
right("abcdef",2) --> "ef"
Mid(string,start,number) Gives the number of character from start
mid("abcdef",4,2) --> "de"
InStr(string1,string2) Gives the position where string 2 is in string1
InStr("abcdef","de") -->4
LTrim The spaces at the start of the string are removed
LTrim("   abcdef  ") --> "abcdef  "
Rtrim The spaces at the end of the string are removed
RTrim("   abcdef  ") --> "   abcdef  "
Trim The spaces at the start and the end of the string are removed
Trim("   abcdef  ") --> "abcdef"
UCase Convert the string in UPERCASE characters
("abcdef") --> "ABCDEF"
LCase Convert the string in lowercase characters
("ABCDEF") --> "abcdef"

Datum- and time functions

Now Gives the current time and date
Date Gives only the current date
Time Gives only the current time
DateAdd Calculates a new date with the following parameters:
newdate=dateadd("X",y,z)
 X=d for days
 X=m for months
 X=w for weeks
 X=n for minutes
 X=h for hours
 Y=number or a variable that contains a number
 Z=original date/time

Example:
expires=dateadd("m",1,date())
expires is 1 month from now.
DateDiff Calculates the differens between 2 dates
DateDiff(Interval,date1,date2)

Example:
Number of days member of this site,
<% =DateDiff("d", #1/1/1999#, Date())%>
The function calculates the days between 1/1/1999 and now

 

TOP

Latest script:

 

Books: