+ Reply to Thread
Results 1 to 7 of 7

determining fractional seconds from serial time

  1. #1
    David Gerstman
    Guest

    determining fractional seconds from serial time

    How do I get fractions of a second from the serial time?
    If I do
    format( t, "hh:mm:ss.sss")

    where t is the time I'm looking at, all the fractional part does is repeat
    the number of seconds as a repeating fraction.

    I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    answer...

    David Gerstman

  2. #2
    Bob Phillips
    Guest

    Re: determining fractional seconds from serial time

    format( t, "hh:mm:ss.000")


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "David Gerstman" <[email protected]> wrote in message
    news:[email protected]...
    > How do I get fractions of a second from the serial time?
    > If I do
    > format( t, "hh:mm:ss.sss")
    >
    > where t is the time I'm looking at, all the fractional part does is repeat
    > the number of seconds as a repeating fraction.
    >
    > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > answer...
    >
    > David Gerstman




  3. #3
    Neal Zimm
    Guest

    Re: determining fractional seconds from serial time

    Hi Dave -
    I tired this after reading your post and got a mis match error.
    Sub test()
    Dim temp As String
    temp = ""
    temp = FormatDateTime(Now, "hh:mm:ss.000")
    MsgBox temp
    Exit Sub

    my need is to measure a time interval in tenths of seconds.
    Can you help please?
    thanks,
    Neal Z.

    "Bob Phillips" wrote:

    > format( t, "hh:mm:ss.000")
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "David Gerstman" <[email protected]> wrote in message
    > news:[email protected]...
    > > How do I get fractions of a second from the serial time?
    > > If I do
    > > format( t, "hh:mm:ss.sss")
    > >
    > > where t is the time I'm looking at, all the fractional part does is repeat
    > > the number of seconds as a repeating fraction.
    > >
    > > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > > answer...
    > >
    > > David Gerstman

    >
    >
    >


  4. #4
    Neal Zimm
    Guest

    Re: determining fractional seconds from serial time

    Hi Bob -
    I tried this and got the seconds just fine, but the tenths of seconds
    always show as zero. Is there a ways to show tenths of secons?
    thanks.
    Neal Z.


    "Bob Phillips" wrote:

    > format( t, "hh:mm:ss.000")
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "David Gerstman" <[email protected]> wrote in message
    > news:[email protected]...
    > > How do I get fractions of a second from the serial time?
    > > If I do
    > > format( t, "hh:mm:ss.sss")
    > >
    > > where t is the time I'm looking at, all the fractional part does is repeat
    > > the number of seconds as a repeating fraction.
    > >
    > > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > > answer...
    > >
    > > David Gerstman

    >
    >
    >


  5. #5
    Dave Peterson
    Guest

    Re: determining fractional seconds from serial time

    But _Bob_ used plain old Format--not FormatDateTime.

    Did you try that?

    Neal Zimm wrote:
    >
    > Hi Dave -
    > I tired this after reading your post and got a mis match error.
    > Sub test()
    > Dim temp As String
    > temp = ""
    > temp = FormatDateTime(Now, "hh:mm:ss.000")
    > MsgBox temp
    > Exit Sub
    >
    > my need is to measure a time interval in tenths of seconds.
    > Can you help please?
    > thanks,
    > Neal Z.
    >
    > "Bob Phillips" wrote:
    >
    > > format( t, "hh:mm:ss.000")
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "David Gerstman" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > How do I get fractions of a second from the serial time?
    > > > If I do
    > > > format( t, "hh:mm:ss.sss")
    > > >
    > > > where t is the time I'm looking at, all the fractional part does is repeat
    > > > the number of seconds as a repeating fraction.
    > > >
    > > > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > > > answer...
    > > >
    > > > David Gerstman

    > >
    > >
    > >


    --

    Dave Peterson

  6. #6
    Dave Peterson
    Guest

    Re: determining fractional seconds from serial time

    Option Explicit
    Sub test()
    Dim temp As String
    Dim temp1 As String
    Dim myTime As Variant

    'just to make sure that there's a fraction of a second
    myTime = Now / 10

    temp = Application.Text(myTime, "hh:mm:ss.000")
    temp1 = Format(myTime, "hh:mm:ss.000")

    MsgBox temp & vbLf & temp1

    End Sub

    VBAs format behaves slightly different than the =text() worksheet function.


    Neal Zimm wrote:
    >
    > Hi Bob -
    > I tried this and got the seconds just fine, but the tenths of seconds
    > always show as zero. Is there a ways to show tenths of secons?
    > thanks.
    > Neal Z.
    >
    > "Bob Phillips" wrote:
    >
    > > format( t, "hh:mm:ss.000")
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "David Gerstman" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > How do I get fractions of a second from the serial time?
    > > > If I do
    > > > format( t, "hh:mm:ss.sss")
    > > >
    > > > where t is the time I'm looking at, all the fractional part does is repeat
    > > > the number of seconds as a repeating fraction.
    > > >
    > > > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > > > answer...
    > > >
    > > > David Gerstman

    > >
    > >
    > >


    --

    Dave Peterson

  7. #7
    Neal Zimm
    Guest

    Re: determining fractional seconds from serial time

    Dear Dave -
    Thanks so much. Yes the vba format does differ from the application.text
    approach.
    a.text WORKS. (and the other does NOT)

    I ran the sub below about 20 times. Temp1 always showed .000 and temp
    varied the fraction.

    Thanks again,
    Neal



    "Dave Peterson" wrote:

    > Option Explicit
    > Sub test()
    > Dim temp As String
    > Dim temp1 As String
    > Dim myTime As Variant
    >
    > 'just to make sure that there's a fraction of a second
    > myTime = Now / 10
    >
    > temp = Application.Text(myTime, "hh:mm:ss.000")
    > temp1 = Format(myTime, "hh:mm:ss.000")
    >
    > MsgBox temp & vbLf & temp1
    >
    > End Sub
    >
    > VBAs format behaves slightly different than the =text() worksheet function.
    >
    >
    > Neal Zimm wrote:
    > >
    > > Hi Bob -
    > > I tried this and got the seconds just fine, but the tenths of seconds
    > > always show as zero. Is there a ways to show tenths of secons?
    > > thanks.
    > > Neal Z.
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > format( t, "hh:mm:ss.000")
    > > >
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "David Gerstman" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > How do I get fractions of a second from the serial time?
    > > > > If I do
    > > > > format( t, "hh:mm:ss.sss")
    > > > >
    > > > > where t is the time I'm looking at, all the fractional part does is repeat
    > > > > the number of seconds as a repeating fraction.
    > > > >
    > > > > I tried dividing by 3600, 12, 12 in order but that gives me the wrong
    > > > > answer...
    > > > >
    > > > > David Gerstman
    > > >
    > > >
    > > >

    >
    > --
    >
    > Dave Peterson
    >


+ Reply to 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