Subtracting Military Time

KirkComer

Registered User.
Local time
Yesterday, 21:49
Joined
Oct 21, 2005
Messages
50
My new job requires me to use access so I'm learning as I go. :confused:
I have already used previous threads from this forum to answer another problem I encountered. Thanks for providing this forum to the public!

I am attemping to run a query that will subtract military time. (I am not allowed to change the format of the times in the original tables. )

Example:

Column A Column B
1111 6.5

I need 1111 - 6.5 in Column C
 
Clarification

My previous thread example didn't show up like I had intended:

Here a better example:

Column A 100
Column B 1.5

Column C I need 100 - 1.5 (answer should be 2350)
 
Last edited:
Hi -

How are these 'times' being stored, i.e. what is the data type of your time field? I'm kind of confused by the example.
If the time is 0100 and you subtract 1.5 hours, the answer in military time
should be 2330, not 2350.

Bob
 
Here is your problem in a nutshell. Time ain't what it appears to be.

Time is stored as the number of DAYS and FRACTIONS of a day, in a DOUBLE quantity. I.e. 64-bit real/floating point.

You will have two choices.

1. Break down the times to components and add/subtract the components individually.

2. Convert (internally only) the stored times to a fraction as described above. Work with them in DOUBLE format until you are ready to store them. Then convert to the real storage format.
 
As raskew pointed out the correct time should have equaled 2330.

Thank you both for replying to my question. I will give The_Doc_Man's words of advice a shot and see what happens.
 

Users who are viewing this thread

Back
Top Bottom