Get date difference in seconds

Clamarc

New Member
Joined
Apr 19, 2023
Messages
20
Office Version
  1. 2016
Platform
  1. Windows
Hi,

My Excel is Prefessional plus 2016

How do I get the difference between two dates in seconds?
date1: 2024-06-21 11:20:35.740
data2: 2024-06-21 10:58:51.110

Note: dates are in the format yyyy/mm/dd hh:mm:ss,000

Thank's
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
If you subtract those dates and multiply the result by 86400 (i.e. 24*60*60), then you should obtain the result.
 
Upvote 0
If you subtract those dates and multiply the result by 86400 (i.e. 24*60*60), then you should obtain the result.
It didn't work for me!... could you give more details about your answer?
see image
 

Attachments

  • img difdate.jpg
    img difdate.jpg
    18.6 KB · Views: 24
Upvote 0
Confirm those are date/time data types and not text with =ISNUMBER(B3) . It should return TRUE. Other than that, @hagia_sofia suggestion works fine as long as you're subtracting big minus small.
Book1
BCD
32024-06-21 11:20:35.7402024-06-21 10:58:51.1101,304.63
Sheet1
Cell Formulas
RangeFormula
D3D3=(B3-C3)*86400
 
Upvote 0
What is your regional setting for the decimal delimiter ? Is it a comma or a period ?
Your copied in data has a period "2024-06-21 11:20:35.740" but you say your custom format is a comma "yyyy/mm/dd hh:mm:ss,000"
Also your image indicates your dates are left aligned which is @Cubist point about checking whether they are numbers or text.

Assuming you need a comma delimiter ideally you want to fix columns B & C, how will depend on how you source your data.
A work around or proof of concept might be
Excel Formula:
=(SUBSTITUTE(B3,".",",")-SUBSTITUTE(C3,".",","))*86400
 
Upvote 0
What is your regional setting for the decimal delimiter ? Is it a comma or a period ?
Hi,
I'm from Brazil, my regional delimiter for decimal is the comma.

Another detail, when I click on the cell, the value in the formula bar appears rounded. How do I make the value appear in the formula bar the same as what is in the cell, see image.
 

Attachments

  • Imagem Arred.jpg
    Imagem Arred.jpg
    36.1 KB · Views: 14
Upvote 0
Hi,
I'm from Brazil, my regional delimiter for decimal is the comma.

Another detail, when I click on the cell, the value in the formula bar appears rounded. How do I make the value appear in the formula bar the same as what is in the cell, see image.
Unfortunately the formula bar not showing the decimal for seconds is a recognised issue that has been around for a long time.
I don't believe there is a solution for it.
 
Upvote 0
Unfortunately the formula bar not showing the decimal for seconds is a recognised issue that has been around for a long time.
I don't believe there is a solution for it.
ok...

One last question, in my Excel log file, when I check the date cells, they appear as ISNUMBER = False, but if I clear the cell and type the dates again and check, they appear as ISNUMBER = True. How do I make the dates in my Excel log file have ISNUMBER = True without having to re-enter the dates? See attached image.

thanks's
 

Attachments

  • Imagem cálculo.jpg
    Imagem cálculo.jpg
    46.7 KB · Views: 15
Upvote 0

Forum statistics

Threads
1,223,954
Messages
6,175,603
Members
452,660
Latest member
Zatman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top