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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

int() function not working

Status
Not open for further replies.

crywrite

Technical User
Feb 7, 2002
34
US
I need to turn 1.25 hours into 1 hour and 15 minutes.

I'm trying to use the Int() function to subtract the interger so I can calculate the remaining minutes.

But the Int() is not working consistantly. I have two records that have 1 hour and the first record with the int function returns 1 and the second returns 0. They are both just 1, not .999 or anything.

Why is the int() func. inconsistant?
 
Int does try to round to the next smallest integer, which is possibly why you're getting what you don't expect. Try Fix() or Truncate() instead.

Naith
 
Personally, when doing any calculations like this I use Truncate(), as follows :

({percentagefield}*60)-(truncate({percentagefield})*60)

in your example of 1.25, this would give you 15. Reebo
Scotland (snowed in)
 
Looks like you beat me to it Naith. Reebo
Scotland (snowed in)
 
the fix() function is working.

Thank you very much!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top