This topic is locked
[SOLVED]

 Time format issue

9/15/2010 5:53:32 PM
ASPRunnerPro General questions
B
btman author

Hi,

I'm new to this forum and new to php and would appreciate if anyone could help me with the following issue.

For a fitness website I'm setting up I want users to enter the time they did for various excersises. I want them to enter the minutes and seconds as e.g. 1.25 or perhaps 125.

My question is: is this possible and how would the correct php format look like? If tried various formats in the custum screen of PHPRunner but it didn't work. All in comnination with various field types of the database.
Also what would the correct field type be used in the database for this field?
Again your help is highly appreciated.

Tx

Ben

Sergey Kornilov admin 9/15/2010

If you plan to perform some kind of calculations on on this time value the best approach is to enter minutes and seconds separately into two different fields.

B
btman author 9/15/2010



If you plan to perform some kind of calculations on on this time value the best approach is to enter minutes and seconds separately into two different fields.



Hi Sergey,

No, there will be no calculations. The purpose is to show it in a graph in order to see progress. I don't think 2 fields will do that.

Tx for your time

Sergey Kornilov admin 9/16/2010

Showing it in a graph means you need to have a consistent numeric value. If you allow a free form entry people will enter anything i.e. '1:25', '1 25', 125, 1.25 etc. You won't be able to do anything useful with this.
Use two fields (minutes and seconds). When you build a chart add a calculated field to your SQL query that either contains minutes or seconds i.e.

select minutes,

seconds,

minutes*60+seconds as total

from ...
B
btman author 9/23/2010



Showing it in a graph means you need to have a consistent numeric value. If you allow a free form entry people will enter anything i.e. '1:25', '1 25', 125, 1.25 etc. You won't be able to do anything useful with this.
Use two fields (minutes and seconds). When you build a chart add a calculated field to your SQL query that either contains minutes or seconds i.e.

select minutes,

seconds,

minutes*60+seconds as total

from ...



Hi Sergey,

I managed to solve my issue by using following query:
SELECT

dist_minutes,

dist_seconds,

concat(dist_minutes, '.', dist_seconds) AS dist_total

From . . .
It adds the mins and secs into 1 field and with this I can put it in a graph.

Thanks for puttong me on the right track.

Ben