Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Converting Decimals into Hours

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-07-2009, 08:42 PM
linum's Avatar
Senior Member
 
Join Date: Sep 2008
Posts: 108
Default Converting Decimals into Hours

How can I convert a decimal value into hours?

For example; I have 62.89 hours. How can I convert the .89 into minutes?




Thank you in advance...
Reply With Quote
  #2 (permalink)  
Old 08-07-2009, 09:10 PM
linum's Avatar
Senior Member
 
Join Date: Sep 2008
Posts: 108
Default

Ok, I think 60 minutes times my decimal then divide by 100 will give me what I'm looking for:

Code:
60 * .89 / 100 = 0.534
Now I just got to figure out how to easily have B4P read my decimal value, omit the 62, read from the period till the end of the value in order to apply the formula above.

Any ideas as to what would be easier?
Reply With Quote
  #3 (permalink)  
Old 08-07-2009, 10:20 PM
linum's Avatar
Senior Member
 
Join Date: Sep 2008
Posts: 108
Default

Ok, I figured it out. I use strSplit to split my string at the period into two:

Code:
word() = strSplit(decimal, ".")
Hope this helps others...
Reply With Quote
  #4 (permalink)  
Old 08-08-2009, 05:48 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Here is another solutions:
Code:
    all = 62.89
hours = 
Int(all)
minutes = 
Round((all - hours) * 60)
Msgbox(hours & ":" & minutes)
Reply With Quote
  #5 (permalink)  
Old 08-08-2009, 01:18 PM
linum's Avatar
Senior Member
 
Join Date: Sep 2008
Posts: 108
Default

Thanks Erel. I had never read about the Int function in the manual before. This is definitely the easiest way to do it.


Thanks again...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
converting a StringArray to a ByteArray Cableguy Questions (Windows Mobile) 9 01-04-2009 03:36 PM
Converting date to ticks value mozaharul Questions (Windows Mobile) 3 10-22-2008 09:51 AM
Help needed converting a VB6 Project Drewpeu Questions (Windows Mobile) 11 10-15-2008 06:13 PM
Problem Converting CSV to SQLite tcgoh Questions (Windows Mobile) 5 11-01-2007 02:50 AM
specifying datatypes when converting table to SQLite DB Steve Questions (Windows Mobile) 1 06-14-2007 04:56 AM


All times are GMT. The time now is 04:45 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0