Closed Thread
Results 1 to 3 of 3

how to find time difference between timestamps to a millisecond?

  1. #1
    sp
    Guest

    how to find time difference between timestamps to a millisecond?

    I have two columns which contain timestamps in the format of yyyy-mm-dd
    hh:mm:ss:msmsms (the last three digits are the milliseconds). I need to find
    the difference of the timestamps in ss:msmsms format.

    I am trying to implement a VB function to do this as there is no predefined
    function available. Can anyone please assist?

    Thanks!

  2. #2
    Bernard Liengme
    Guest

    Re: how to find time difference between timestamps to a millisecond?

    If you have date/time in exactly that format (ie 05 for fifth month not just
    5) then this formula will convert your data to Excel's date/time format
    =DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))+TIME(MID(A1,12,2),MID(A1,15,2),MID(A1,18,2))+RIGHT(A1,3)/1000/60/60/24
    You will need to format the cell with yyyy/mm/dd hh:mm:ss.000
    In my test I changed 2006-06-10 05:45:15:349 to 2006/06/10 05:45:15.349
    To get difference, I used =ROUND((F2-F1)*24*60*60,3)
    best wishes
    --
    Bernard V Liengme
    www.stfx.ca/people/bliengme
    remove caps from email

    "sp" <[email protected]> wrote in message
    news:[email protected]...
    >I have two columns which contain timestamps in the format of yyyy-mm-dd
    > hh:mm:ss:msmsms (the last three digits are the milliseconds). I need to
    > find
    > the difference of the timestamps in ss:msmsms format.
    >
    > I am trying to implement a VB function to do this as there is no
    > predefined
    > function available. Can anyone please assist?
    >
    > Thanks!




  3. #3
    sp
    Guest

    Re: how to find time difference between timestamps to a millisecon

    Thank you!

    "Bernard Liengme" wrote:

    > If you have date/time in exactly that format (ie 05 for fifth month not just
    > 5) then this formula will convert your data to Excel's date/time format
    > =DATE(LEFT(A1,4),MID(A1,6,2),MID(A1,9,2))+TIME(MID(A1,12,2),MID(A1,15,2),MID(A1,18,2))+RIGHT(A1,3)/1000/60/60/24
    > You will need to format the cell with yyyy/mm/dd hh:mm:ss.000
    > In my test I changed 2006-06-10 05:45:15:349 to 2006/06/10 05:45:15.349
    > To get difference, I used =ROUND((F2-F1)*24*60*60,3)
    > best wishes
    > --
    > Bernard V Liengme
    > www.stfx.ca/people/bliengme
    > remove caps from email
    >
    > "sp" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have two columns which contain timestamps in the format of yyyy-mm-dd
    > > hh:mm:ss:msmsms (the last three digits are the milliseconds). I need to
    > > find
    > > the difference of the timestamps in ss:msmsms format.
    > >
    > > I am trying to implement a VB function to do this as there is no
    > > predefined
    > > function available. Can anyone please assist?
    > >
    > > Thanks!

    >
    >
    >


Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1