Adding time intervals - format problem

  • Thread starter Thread starter Leonard Priestley
  • Start date Start date
L

Leonard Priestley

I have designed a report of hours worked, with totals for a number of
shifts. I have converted two time intervals into minutes and then added
them. To convert back into the hours:minutes format, I have used this
expression in a textbox:

Total = [TotalMinutes]\60 & ":" & [TotalMinutes] Mod 60

This is satisfactory in most cases. However, if the number of minutes in
the Total is less than ten, there is no leading zero. That is, a total that
I want to appear as 6:04 is presented as 6:4. It looks wrong and is
noticeable because other totals such as 10:16 have two digits in the minutes
place. How can I overcome this? I can put an expression in a textbox, but
I guess I can't put code and make If -- Then decisions can I?

Leonard Priestley
 
Leonard,

Try:

Total = [TotalMinutes]\60 & ":" & Format(([TotalMinutes] Mod 60),"00")

HTH,
Nikos
 
Wow!

That is just amazing. I have so much to learn. Thank you very much, and
have a nice weekend.

Leonard

Nikos Yannacopoulos said:
Leonard,

Try:

Total = [TotalMinutes]\60 & ":" & Format(([TotalMinutes] Mod 60),"00")

HTH,
Nikos

Leonard Priestley said:
I have designed a report of hours worked, with totals for a number of
shifts. I have converted two time intervals into minutes and then added
them. To convert back into the hours:minutes format, I have used this
expression in a textbox:

Total = [TotalMinutes]\60 & ":" & [TotalMinutes] Mod 60

This is satisfactory in most cases. However, if the number of minutes in
the Total is less than ten, there is no leading zero. That is, a total that
I want to appear as 6:04 is presented as 6:4. It looks wrong and is
noticeable because other totals such as 10:16 have two digits in the minutes
place. How can I overcome this? I can put an expression in a textbox, but
I guess I can't put code and make If -- Then decisions can I?

Leonard Priestley
 
Back
Top