473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Milliseconds

I looking for some help in completing the code below for use within an
access app. I currently attach my database to an application which
stores a swimmer's time. The problem I'm having is that the the
swimmer's time within the table displays 67.62 seconds. The code below
modifies this to read 00:01:08:00. I'm hoping someone could help with
getting the code to display 00:01:07.62

Public Function TimerStuff(TimeElapsed As Double) As String
Dim Seconds As Double
Dim Minutes As Double
Dim Hours As Double
Dim A As String
'Find The Seconds
Seconds = TimeElapsed Mod 60
'Find The Minutes
Minutes = (TimeElapsed \ 60) Mod 60
'Find The Hours
Hours = (TimeElapsed \ 3600)
'Format The Time
If Hours >= 0 Then
A = Format(Hours, "00") & ":"
End If
A = Format(Hours, "00") & ":"
A = A & Format(Minutes, "00") & ":"
A = A & Format(Seconds, "00.00")
TimerStuff = A
End Function

Jul 21 '06 #1
1 3685
ma****@msn.com wrote:
I looking for some help in completing the code below for use within an
access app. I currently attach my database to an application which
stores a swimmer's time. The problem I'm having is that the the
swimmer's time within the table displays 67.62 seconds. The code below
modifies this to read 00:01:08:00. I'm hoping someone could help with
getting the code to display 00:01:07.62

Public Function TimerStuff(TimeElapsed As Double) As String
Dim Seconds As Double
Dim Minutes As Double
Dim Hours As Double
Dim A As String
'Find The Seconds
Seconds = TimeElapsed Mod 60
'Find The Minutes
Minutes = (TimeElapsed \ 60) Mod 60
'Find The Hours
Hours = (TimeElapsed \ 3600)
'Format The Time
If Hours >= 0 Then
A = Format(Hours, "00") & ":"
End If
A = Format(Hours, "00") & ":"
A = A & Format(Minutes, "00") & ":"
A = A & Format(Seconds, "00.00")
TimerStuff = A
End Function
Here's how I might try it (air code):

'Begin Module Code-------
Type SwimTime
Hours As Integer
Minutes As Integer
Seconds As Double
End Type

Public Function FormatSwimTime(theSwimTime As SwimTime) As String
FormatSwimTime = Format(theSwimTime.Hours, "00") & ":" &
Format(theSwimTime.Minutes, "00") & ":" & Format(theSwimTime.Seconds,
"00.00")
End Function
'End Module Code------------

Then in your function:

Dim ASwimTime As SwimTime
....
Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)
....
ASwimTime.Hours = Hours
ASwimTime.Minutes = Minutes
ASwimTime.Seconds = Seconds
TimerStuff = FormatSwimTime(ASwimTime)
End Function

Actually, the 'Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)' part
is probably all you really need to make your code work.

James A. Fortune
CD********@FortuneJames.com

Jul 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Richard Visser | last post by:
Hi, i've found this DateRangeSelector : http://www.petrafex.com/view/pgID/21/db/pages/date_range_selector_date_manip ulation__dates_.html . This works fine but i need it to send the dates as :...
2
by: Kevin Thomas | last post by:
Hello, I have a date value in a table SQL Server database that looks like this: 2005-10-11 12:54:36.860 When I load the record into a dataset in VB.NET and retrieve the date value into code,...
11
by: S_at_work | last post by:
hello, can anybody give me a piece of code , or a hint , how i can recieve the time i need for connect() to another host in milliseconds. My problem is i want test the performance of...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
2
by: Harlin Seritt | last post by:
How can I take a time given in milliseconds (I am doing this for an uptime script) and convert it to human-friendly time i.e. "4 days, 2 hours, 25 minutes, 10 seonds."? Is there a function from the...
2
by: Rajat | last post by:
Hi, I have to draw a real time chart in which I have several entries at the same second (i.e. HH:MM:SS:Milleconds) The charting component only takes julian date for drawing the dates. I am...
13
by: Sharon | last post by:
I need to test a performance of some code of mine. I tried using the Environment.TickCount but its resolution is too low (from the MSDN remarks: The resolution of the TickCount property cannot be...
2
by: vinodtr | last post by:
Hi all, I have a date which is represented by the number of milliseconds since January 01, 1970. I need to change this back to DATE format. Is there any built in function in DB2 to do the needed...
6
by: Manikandan | last post by:
Hi, I need to insert the datetime with milliseconds value into a datarow. My code as below DataTable testDataTable=new DataTable(); testDataTable.Columns.Add("updatedDateTime",...
16
by: Nathan Sokalski | last post by:
I have a control uses the date and time, including milliseconds. I want to be able to enter this information as an attribute in the *.aspx page. Because all attributes are entered as strings in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.