Multipy time?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a Date/Time field that I am trying to multipy in a query. The field is
formatted in short time (hh:mm), but shows as (h:mm)-don't know why. I need
to multiply this time by 1.5. I need the result to be in (h:mm) format.
How can I do this?
In my query, times come out as: (ex. 0:38 results 0.039583)

My SQL expression is:
Select Time*1.5
From Table
 
I have a Date/Time field that I am trying to multipy in a query.
You can not do it. A DateTime field store a value that is a point IN TIME
but not time in hours and minutes.
To multiple a value in a DateTime field would be like multiplying 1.5 times
3 July 2007. If you do this you will get 58899 because 3 July 2007 is
stored as 39266, the number of days since midnight 31 December 1899.
 
[TimeField] * 24 * 60 = number of minutes
1.5*24*60*[TimeField] = number of minutes.

You may or may not want to strip off the partial minutes. Use Int to only
show whole minutes.
Int(1.5*24*60*[TimeField] )

You can convert the minutes to display in a format of hours and minutes.
1.5*24*60*[TimeField] \ 60 & ":" & Format(1.5*24*60*[TimeField]) Mod
60,"00")


--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Although you can do as John indicates, I'm with Karl on this one. If you
want to store a duration, use a long or single data type to store minutes or
hours. Then you can do math with that value.
 
Back
Top