Decimal To Time

SydsPop

New member
Local time
Today, 09:25
Joined
Jun 5, 2009
Messages
5
Hi All;

I am using the expression below to convert from decimal to time. The problem I am having, is that when the result includes a leading zero (13:04), it doesn't display the zero (13:4). Any ideas on how to fix this?

Thanks-
Pete

Int([AGACD]/60) & ":" & ([AGACD]-(60*Int([AGACD]/60)))
 
Try:

Int([AGACD]/60) & ":" & Format(([AGACD]-(60*Int([AGACD]/60))),"00")

Matthew
 
What is the value of AGACD originally that you are trying to convert?
 
In other words have you tried using CDate([AGACD]) instead?
 
Your problem is the integer stuff.

If your data exists as separate integer hours and minutes (or minutes and seconds), convert the individual numbers as:

Format( (CDbl( [Seconds] + ( 60 * [minutes] ) + ( 3600 * [hours] ) )/86400), "hh:nn:ss" )

Or something similar to that. Works because date/time fields are days and fractions since a reference date. The equation converts hours, minutes, and seconds to fractions of a day. As long as the hours are < 23, the above would work because the Format routines will recognize the time format correctly.
 

Users who are viewing this thread

Back
Top Bottom