Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove numbers before decimal point 2

Status
Not open for further replies.

ukwebsite

Programmer
Dec 9, 2000
82
GB
Please can someone help.

I have a number coming from a database that represents a time i.e. 15.066669845581

I need to slit this into 2 variable one containing the number before the decimal point ie. 15 and one after ie 066669845581.

Sorry if this is confusing.
Matthew

Matthew Wilde
matthew@ukwebsite.com
 
I would reccommend converting the number to a string and simply performing a split

Dim myArr as array
myArr = ctype(myNumber, string).split(".")

Then you can get the values

myArr(0) ' would = 15
myArr(1) ' would be the stuff after the .
 
Another solution would be to use the Fix function (removes decimal value from number, no rounding) and have a line like:
Code:
myNumber = myNumber - Fix(myNumber)

Basically you taking the number with decimal value and subtracting th number without the decimal, leaving you with just the decimal :)

Just a differant way to look at it,
-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top