Jump to content

hundreths of a second


sseeley

Recommended Posts

There is a problem with storing hundreths of a second within MYSQL.  Does anyone have a idea of how I can store 1 hours, 27 minutes, 15 seconds, and 85 hundreths of a second?

 

I am trying to store athletics times.

 

Many thanks in advance.

 

Regards

 

Stuart

Link to comment
Share on other sites

There is a problem with storing hundreths of a second within MYSQL.  Does anyone have a idea of how I can store 1 hours, 27 minutes, 15 seconds, and 85 hundreths of a second?

What about to store hundredths value in a separate INT column ?

Link to comment
Share on other sites

There is a problem with storing hundreths of a second within MYSQL.  Does anyone have a idea of how I can store 1 hours, 27 minutes, 15 seconds, and 85 hundreths of a second?

What about to store hundredths value in a separate INT column ?

 

Then he loses the flexibility of for example sorting

Link to comment
Share on other sites

1:27:15,85

1:15:12,95

 

returns:

 

1:15:12,85

1:27:15,95

 

According to you that would be correct?

According to me that would be not. Please, pay attention that you broken rows and mixed one with another. It can not be.

 

Please, check:

 

CREATE TABLE `athletics_time` (
`main_time` TIME NOT NULL ,
`hundredths` INT NOT NULL 
);

INSERT INTO `athletics_time` (
`main_time` ,
`hundredths` 
)
VALUES (
'1:27:15', '85'
), (
'1:15:12', '95'
)
;

SELECT * 
FROM `athletics_time` 
ORDER BY main_time, hundredths
;

Link to comment
Share on other sites

Oeps my bad I replied a bit to hasty. I had thought about it before I suggested the time2dec() using an extra column but forgot that MySQL does not sort by column but by row.

Yeah, a bit too hasty. But sseeley has few ways out now. Not only few columns.  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.