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

 Page 1 of 1 [ 2 post ]

Relevant Pages