Convert 23.31 into 559:26 ([hh]:mm format)

I

igorin

Hello,

I have a field for the amount of time that a machine runs each day.

The maximum amount of time can be 1, which equals 24 hours. Fractions are
expressed in decimals. For example, 12 hours is 0.5.

I have created a sum query with the wizard. Now I get a total amount of
23.31. I am using this query in a totals form.

How can I convert this into [hh]:mm format so that what I see on the form is
559:26?
 
J

John Spencer

One method
Int(23.31) * 24 & ":" & FORMAT((23.31-Int(23.31))*60,"00")

Another method
Int(23.31)*24 & ":" & Format((23.31*60) Mod 60,"00")

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
I

igorin

John,

I'm not very good at Access, so please excuse what surely is a dumb
question: Where do I use this expression and how?

I think that it must be in the Query using SQL but I'm not certain of how to
include it or even where.

Thank you very much for the help!

--
igor


John Spencer said:
One method
Int(23.31) * 24 & ":" & FORMAT((23.31-Int(23.31))*60,"00")

Another method
Int(23.31)*24 & ":" & Format((23.31*60) Mod 60,"00")

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

Hello,

I have a field for the amount of time that a machine runs each day.

The maximum amount of time can be 1, which equals 24 hours. Fractions are
expressed in decimals. For example, 12 hours is 0.5.

I have created a sum query with the wizard. Now I get a total amount of
23.31. I am using this query in a totals form.

How can I convert this into [hh]:mm format so that what I see on the form is
559:26?
 
I

igorin

John, I figured it out!

It worked perfectly! Thank you very much!!!

--
igor


John Spencer said:
One method
Int(23.31) * 24 & ":" & FORMAT((23.31-Int(23.31))*60,"00")

Another method
Int(23.31)*24 & ":" & Format((23.31*60) Mod 60,"00")

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

Hello,

I have a field for the amount of time that a machine runs each day.

The maximum amount of time can be 1, which equals 24 hours. Fractions are
expressed in decimals. For example, 12 hours is 0.5.

I have created a sum query with the wizard. Now I get a total amount of
23.31. I am using this query in a totals form.

How can I convert this into [hh]:mm format so that what I see on the form is
559:26?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top