Leading zeros in minutes 
Author Message
 Leading zeros in minutes

Need some help with leading zeros with hh:nn.  I have a function that adds
times (in short time format) and gives the result in hh:nn format.  If the
minutes are less than 10 I only get one digit for minutes.  Here is the last
part of code:

    totalhours = Int(CSng(interval * 24))
    totalminutes = Int(CSng(interval * 1440))
    Hours = totalhours Mod 24
    minutes = totalminutes Mod 60

 SevenDay = Format(totalhours & ":" & minutes, "hh:nn")

I'm using Access 97 and any help is appreciated.

Ron



Sat, 04 Nov 2000 03:00:00 GMT  
 Leading zeros in minutes

I am not sure what you are trying to do. The hours and Minutes are
calculated but not used.

If you have two fields are  in short time, then the simplest way would
be to
Format(Timediff,"hh:mm")

alternately, you can calculate the difference in minutes and then

intHours =inttotalminutes \ 24               ' gives the quotient only
inMinutes = inttotalminutes mod 24       ' gives the remainder only

and diff = format(intHours,"00") & ":" & format(intminute,"00")

Nirmala Sekhar

--------------------------------------------------------------------------------------------
{*filter*} Software Consultant / Developer
--------------------------------------------------------------------------------------------



Quote:
>Need some help with leading zeros with hh:nn.  I have a function that adds
>times (in short time format) and gives the result in hh:nn format.  If the
>minutes are less than 10 I only get one digit for minutes.  Here is the last
>part of code:

>    totalhours = Int(CSng(interval * 24))
>    totalminutes = Int(CSng(interval * 1440))
>    Hours = totalhours Mod 24
>    minutes = totalminutes Mod 60

> SevenDay = Format(totalhours & ":" & minutes, "hh:nn")

>I'm using Access 97 and any help is appreciated.

>Ron



Sun, 05 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. leading zeros

2. Leading Zeros

3. Trim leading zeros from string

4. Adding leading zeros ???

5. Excel VBA - Pad SSN's w/Leading Zeros

6. Excel Xp VBA - Pad SSN's w/Leading Zero's

7. I automatically want leading zeros before a number

8. Leading zeros gone after merging wordfile with access data fields

9. Leading Zeros

10. Times and Leading Zeroes

11. Way to format a number with leading zeroes?

12. leading zero's

 

 
Powered by phpBB® Forum Software