473,500 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting Decimal Time to Regular Time

6 New Member
Hello,


I need a format function for a query that will Convert: Decimal Time to Regular Time.

For Example my Database stores 8 Hours and 15 Min as: 8.25000008940697

And now I need a function to bring it back to: 8.15

Any help is greatly appreciated.
Oct 31 '07 #1
11 12556
missinglinq
3,532 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. Hours = int(OriginalTime)    
  2.  
  3. Minutes = int((OriginalTime-int(OriginalTime))*60)
  4.  
  5. NewTime = Hours & "." & Minutes
or in a calculated field in the Query Grid

Expand|Select|Wrap|Line Numbers
  1. NewTime: int(OriginalTime) & "." & int((OriginalTime-int(OriginalTime))*60)
Welcome to TheScripts!

Linq ;0)>
Oct 31 '07 #2
elliotmf
6 New Member
Wow, pretty good.

Now, I need to sum this feild and I'm having issues with that.

When I keep it the feild a NUMBER format is cuts off the minuites and if I keep the feild a TEXT feild I can't do a SUM Total.

Thanks Again.
Oct 31 '07 #3
elliotmf
6 New Member
I think I found my issue, But I can't see to solve it:

My Database records it as :6.08333333954215

Which is: 6 Hours and 5 Minuites

When I run the function you gave me it returns:

6.5

When we really need it to return 6.05


Thanks!!
Oct 31 '07 #4
ADezii
8,834 Recognized Expert Expert
I think I found my issue, But I can't see to solve it:

My Database records it as :6.08333333954215

Which is: 6 Hours and 5 Minuites

When I run the function you gave me it returns:

6.5

When we really need it to return 6.05


Thanks!!
Following Linq's logic:
Expand|Select|Wrap|Line Numbers
  1. ? Format(int(6.08333333954215) & "." & int((6.08333333954215-int(6.08333333954215))*60), "hh:mm" returns 06:05
Oct 31 '07 #5
missinglinq
3,532 Recognized Expert Specialist
Thanks for the assist, ADezii! I was in a hurry and only tested against the data provided! I apologize!

Linq ;0)>
Nov 1 '07 #6
ADezii
8,834 Recognized Expert Expert
Thanks for the assist, ADezii! I was in a hurry and only tested against the data provided! I apologize!

Linq ;0)>
Anytime Linq, just didn't want you to think that I was stepping on your toes (LOL).
Nov 1 '07 #7
elliotmf
6 New Member
Thanks, I guess the issue I'm having is:

I can't seem seem to Total the results, I tried a query and I also tried doing a Sum in the report. I get an error message in ACCESS that the query is too Complex.

Here is what I'm doing:

Value of Feild: 8.15000009536743
When I run the Query I get 8:09 (which is good)

But when I try to run a query to TOTAL the results--I get the Error Message.

I tried dumping the info to a table, but if I set it to TEXT I can't TOTAL it.. and if I set it to number I loose the values

Please Help.
Thanks
Nov 1 '07 #8
missinglinq
3,532 Recognized Expert Specialist
I think what you need to do is to run you total against the original field (your "decimal" times) and then plug the results into the formula above to get your total in hours and minutes.

Linq ;0)>
Nov 1 '07 #9
elliotmf
6 New Member
Thanks!! It worked. Thanks for ALL Your Help.
Nov 1 '07 #10
missinglinq
3,532 Recognized Expert Specialist
Glad we could help!

Linq ;0)>
Nov 1 '07 #11
elliotmf
6 New Member
Hello,

The report basicly workds for me, But I'm still having an issue properly formating decimal time to regular time in totals. I was thinking to email you guys the Database it's a small Access 2003 DB. Is anyone instrested in helping in this way?
Nov 29 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

6
3172
by: Newbee Adam | last post by:
I have been reading in help how I need to use decimal becuase currency does not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take the value of text...
2
7656
by: Mariusz Sakowski | last post by:
I'm writing class which will be able to store large numbers (my ambition is to make it able to operand on thousands of bits) and perform various operations on it (similiar to those available with...
2
3445
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
7
4575
by: Paul K | last post by:
I'm writing a small component that needs to be as fast as possible. The component needs to convert a string to decimal during the course of it's processing. However, I need to test the string...
3
2162
by: Daniel | last post by:
I'm writing an application that (among other things) evaluates mathematical expressions. The user enters strings containing literals and names that later get evaluated using the Python interpreter....
5
5559
by: Jeff Dillon | last post by:
How might I convert a string like 10.A (in hex) to it's decimal equivalent? Basically I have an input string like ((1F.A + 3A.D) - 1F.E) and need to calculate the result. Using Reflection and...
28
5804
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
4
3440
by: Jeff | last post by:
Hey ..NET 2.0 In my code am I trying to convert an int value into a decimal: decimal d = 0; int k = 87664; d = Convert.ToDecimal(k/100);
10
5299
by: Jason | last post by:
I'm making a program that will convert decimal inputs (in this case, in inches) and output a fractional answer. At the moment, I'm only able to output the fractional answer in three parts: A whole...
0
7136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7235
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6909
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7397
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4614
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
317
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.