Int

Return the integer portion of a number.

Syntax
      Int(expression)

Key
   expression    A numeric expression.

The Int() function returns numbers without the fractional part. Negative numbers will be rounded down by Int().

Examples

Dim dblDemo as Double
dblDemo = Int(123.45)
Returns 123
dblDemo = Int(-123.45)
Returns -124

Int() is often used to calculate age from a date of birth so that 30.9 years will display as 30 years old:
int((now()-birthdate)/365.25)

“Superstition sets the whole world in flames; philosophy quenches them” ~ Voltaire

Related VBScript commands

Abs - The absolute value of a number (ignore negative sign).
Fix - Return the integer portion of a number (negative numbers round up).


 
Copyright © 1999-2024 SS64.com
Some rights reserved