473,804 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hh:mm:ss + hh:mm:ss values in query don't add up

547 Contributor
I first deducted the laptime and actualstarttime of a race in a query using this formula and it gives me a correct lap1time value

Lap1Time:nz(For mat([Lap1]-[Actualstarttime],"hh:nn:ss") ) = 00:51:54
if i repeat this for lap2 to determine the lap2time value
Lap2Time: Nz(Format([Lap2]-[lap1],"hh:nn:ss") ) = 00:00:03
and the 3rd lap = 00:00:03

It produces the correct time

My problem is adding up these to laptimes to get a totaltime from the start. I dont want to just deduct the finaltime after the 3rd lap from the actualstartingt ime, as the number of laps may vary from race to race and i therefore prefer to add up the laps. My vb programming skills are lacking here.
i think the data type is string and it is formatted as hh:mm:ss - that is the problem.

TotalTime: Format([Lap1time]+[lap2time]+[lap3time],"hh:nn:ss")

lap1time = 00:51:54 ; lap2time= 00:00:03 ;
lap3time=00:00: 03

then i get = 00:51:5400:00:0 300:00:03 which is a combination of lap1time+lap2ti me+lap3time rather than adding it up and giving you = 00:52:00
i think the data type is string and it is formatted as hh:mm:ss - that is the problem.

anybody out there that can relieve me of this unnecessary stress in my life by providing a solution? hehehe

Attached Images
File Type: jpg total1.jpg (43.8 KB, 428 views)
File Type: jpg addlap2.jpg (38.1 KB, 535 views)
Nov 26 '10 #1
4 2608
ADezii
8,834 Recognized Expert Expert
The following Logic should work, as long as you do not go past 24hrs. Total, but I'll leave that for you to test:
Expand|Select|Wrap|Line Numbers
  1. Debug.Print Format$(CDate("00:51:54")+CDate("00:00:03")+CDate("00:00:03"),"hh:nn:ss")
Result:
Expand|Select|Wrap|Line Numbers
  1. 00:52:00
Nov 27 '10 #2
neelsfer
547 Contributor
thx mr Adezii; you saved me again!!
Nov 27 '10 #3
ADezii
8,834 Recognized Expert Expert
You are quite welcome, but after all I am a little more familiar with the DB than most (LOL).
Nov 27 '10 #4
NeoPa
32,579 Recognized Expert Moderator MVP
The general rule of keeping dates and times in DateTime format for storage and string format only for displaying values is a good one that would save you from this problem.
Nov 27 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
13035
by: Assimalyst | last post by:
Hi i have a value entered into an asp text box, procedureDateTxtBx.Text, thet has the format dd/MM/yyyy. I need to convert this into a format recognisable by SQL server in order to properly query the database. I've tried a few DateTime.Parse methods but can't get any to work. The format of these values in the database is yyyy-MM-dd hh:mm:ss.000
3
3006
by: jobi | last post by:
Hi, I've tried to get to this formatting stuff once, a while ago. I still didn't figure out how to format a date-column in a (data)-grid. I have a dynamic query that returns a # of columns. When it contains datetime-columns, I want these columns formatted like SQLServer-datetimeformat 121. I don't want the query to return datetime-columns converted to strings because they are used for calculations
16
12699
by: Filips Benoit | last post by:
Dear all, I have a datefield that sometimes should store hours and minutes too ans use following format and inputmask. dd/mm/yyyy hh\:nn 09/09/0000\ 99:99;0;* Typing date, hour and minutes is OK.
12
29482
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as follows: function doDateCheckNow(source, args) { var oDate = document.getElementById(source.controltovalidate); // dd/mm/yyyy
7
2776
by: mr.nimz | last post by:
hello, this is antenio. recently i've come to a problem. i got a way through it, somehow, still it left me in a curious state, so i'm posting it here, if i can get an answer from some techy, here is my table structure, Name: Table1
8
1527
by: John | last post by:
Hi I am using the below code to run a sql on an underlying access table; insStr = "INSERT INTO ( Action, , , Request_Date ) " & _ "VALUES (""Modify Client"", 93, ""Administrator"", Now())" Dim insCmd As New OleDbCommand(insStr, dbConContacts)
1
2169
seshu
by: seshu | last post by:
Hi every body to morning my cousine has show his application and also his live db in that to sav the length of all the voice files he has saved in time format ie he took the datatype of time now i want to generate a an excell sheet of that table but here i want the time to be like mm:ss but not hh:mm:ss examle the length of song sweet dreams is 01:12:35 now i want this to be shown as 72:35 how is there any procedure to convert directly in...
2
16806
by: smitanaik | last post by:
hi i want to do validation of datetime in javascripti.e is i want it in this format dd:mm:yyyy:hh:mm:ss plz heklp me out its urgent
11
7463
by: neelsfer | last post by:
how add (longtime) totaltime = + in query; i need to be able to add more than 24hrs also but it can still show in this format ie (hh:mm:ss) 31:10:20 = 31hrs 10min 20sec pls help
2
5007
by: impin | last post by:
i have stored the user break times in the database... user break start time and end time... the timestamp stored in the database in the (yyyy-mm-dd hh:mm:ss) format in the database... when i retrieve the time from the database the time will be like this... 2010-10-26 10:00:39 but i want only the time part. i.e 10:00:39
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7643
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.