Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiplying time in Access? 1

Status
Not open for further replies.

Focusfocs

Programmer
May 3, 2004
35
US
Hi,
I have a db with the requirement of having to multiply time...can this be done via an Access query without too much hassle?
 
Any chance you could clearly explain what you want to do with what ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I agree with PH. A simple example of what you want to do would be very helpful and only take a few seconds.

You can multiply those few seconds of time by the number of tek-tip viewers that read this thread and find the the total time lost reading a vague question.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
My apologies. I have a database that captures data in a field named "TripTime". This field is in Short time format and has hours and minutes stored in it. It represents the time it takes to complete a trip. We now would like this field to be doubled...as for a round trip. Multiplying this value by 2 creates erronious data. I would like to know how to multiply a short date formatted field by 2 that will produce the number of hours and minutes it takes for a round trip. ...
 
more ado about nothing?

Date/time in Ms. A. is approximatly a "double". In this value, the Whole number portion represents the days since 12/30/1899, while the fractional/decimal part represents the fraction of the day. In general use, date time (e.g. NOW() is stored as the entire Date datatype (e.g. having a DATE (# of days since ... ) and the Time (part of the day).

It is quire legal and reasonable to "Multiply" the variable, but you must take some care in interperting the results. In particular, you must assure that you are multiplying the part(s) that are of interest, and that the results are displayed in an appropiate format. Thus, it would be necessary to assure that you are only dealing with the fractional part (TripTime) without the date (whole number part) and that the results do not exceed "1" if you intend to use the intrinsic date formats to display the results.

some interesting resulte:

Code:
TripTime = #6:36#
? format (TripTime * 2, "Short time")
13:12
which is quite reasonable and propper


triptime2 = #12:30#
? format (TripTime2 * 2, "Short time")
01:00
illustrates the hazzardous use of the intrinsic formats





MichaelRed


 
Friend, i guess the user make it a little mess, but it worked for me, so i would like to put it more clear:

Select NroCongresista,Format(Sum(TipodeMovimiento*Fecha),"Long Time") from MovimientosTable group by NroCongresista;

this, return this:
NroCongresista Expr1001
293 12:03:43 AM
294 12:00:04 AM

it , may sound confusing, but if u check this:
ID ParticipantesTableId NroCongresista TipodeMovimiento Descripcion Fecha
109 1 293 -1 SISTEMA 4/30/2006 2:40:32 AM
108 1 293 1 Entrada 4/30/2006 2:36:52 AM
105 1 293 -1 Salida 4/30/2006 2:36:42 AM
104 1 293 1 Entrada 4/30/2006 2:36:39 AM
107 11 294 -1 Salida 4/30/2006 2:36:51 AM
106 11 294 1 Entrada 4/30/2006 2:36:47 AM

there are, just the right values.

Resuming: it calculates the time, enlapsed for each case: 293, 294. - which are exactly: 3 minutes and 43 seconds, and 3 seconds for the other.

i wish it helps you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top