If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Subtract Datetime

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-09, 14:27
Sankur Sankur is offline
Registered User
 
Join Date: Nov 2009
Posts: 8
Subtract Datetime

Hi,

I have 2 datetime fields and i would like to find the difference of the two and display in a third field. How will it be done?

ScanDateTime & DataDateTime : yy/mm/dd hh:mm:ss format
Longest Time : hh:mm:ss format

The fields i have are:

Code:
ScanDateTime            DataDateTime              Longest Time
09/11/15 05:00:00      09/12/03 10:47:00             ???

Sankur.
Reply With Quote
  #2 (permalink)  
Old 11-19-09, 16:02
Ax238 Ax238 is offline
Registered User
 
Join Date: May 2009
Posts: 253
Just enter a formula in the Longest Time of B2-A2 and then format it the way you want. For example, you could format it as follows to get it to say "18 days, 05 hours, 47 minutes":
Code:
dd "days," hh "hours," mm "minutes"
You could also just format the cell as a number and get a value of 18.24.

Ax
Reply With Quote
  #3 (permalink)  
Old 11-19-09, 23:47
Sankur Sankur is offline
Registered User
 
Join Date: Nov 2009
Posts: 8
Ax,

I used the "B2-A2" way to get the Longest TIme and set the format as "Custom - hh:mm:ss", but im not getting the corrext value.

Code:
ScanDateTime            DataDateTime              Longest Time
09/11/15 05:00:00      09/12/03 10:47:00           05:47:00
I want the time to be shown in the "hh:mm:ss" format. But it is not working.

Sankur.
Reply With Quote
  #4 (permalink)  
Old 11-20-09, 05:30
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 477
If you want the day difference to be accrued within the hours then change the custom format to [hh]:mm:ss

That would display a result of 437:47:00

Hope that helps...
Reply With Quote
  #5 (permalink)  
Old 11-20-09, 14:15
Sankur Sankur is offline
Registered User
 
Join Date: Nov 2009
Posts: 8
Thanks - i got it now.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On