Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default 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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determining Response Time cdavis82 Excel Discussion (Misc queries) 1 November 4th 08 08:28 AM
Time Serial ma1000 Excel Discussion (Misc queries) 4 October 29th 08 06:32 AM
How do I change a minutes and seconds as a 2400 time to seconds? NickBrown419 Excel Worksheet Functions 1 August 10th 08 09:12 PM
Converting date/time serial values to cumulative time totals... Kevin B Excel Discussion (Misc queries) 4 October 18th 07 05:05 PM
Convert "Time Interval" in "hours : minutes : seconds" to seconds Ianukotnorth New Users to Excel 7 May 8th 05 08:11 PM


All times are GMT +1. The time now is 06:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"