Time Difference in Seconds

georgemathew46

New Member
Joined
Jun 5, 2013
Messages
22
Hi,

i have start time in variable 1 and end time in variable 2.

if i minus, i am getting some big numbers.

i am a newbie to excel macro.

So could you help me in this scenario to get output in seconds.

Many thanks in advance
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Maybe like:
<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN><br>    <br><SPAN style="color:#00007F">Sub</SPAN> example()<br>    <br><SPAN style="color:#00007F">Const</SPAN> STARTTIME <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN> = #6/10/2013 3:00:00 PM#<br><SPAN style="color:#00007F">Const</SPAN> ENDTIME <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN> = #6/10/2013 3:01:12 PM#<br>    <br>    MsgBox ElapsedTime(STARTTIME, ENDTIME)<br>    <br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br>    <br><SPAN style="color:#00007F">Function</SPAN> ElapsedTime(<SPAN style="color:#00007F">ByVal</SPAN> Start <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN>, <SPAN style="color:#00007F">ByVal</SPAN> Finish <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Long</SPAN><br>    ElapsedTime = ((Finish - Start) * 24 * 60 * 60)<br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>

Hope that helps,

Mark
 
Upvote 0

Forum statistics

Threads
1,215,528
Messages
6,125,342
Members
449,218
Latest member
Excel Master

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