View Full Version : storing time in a table


puafo
02-11-2008, 01:15 AM
Hi,

Firstly this is my first post so please forgive me if i do not conform to the usual way of asking a question!

I have an access database set up and it is working well, so far!

What I wish to do is the following, I am creating this for a cycling club to store race results...

I wish to store the time that they completed the stage in, how do i do this using the date/time field option when all it wants to do is store a complete time.

for example i wish to store 1 hour 12 minutes 15 seconds in the table as 1:12:15 for stage 1.

Plus they may have received a penalty, so in another field I would like to say store a 10 second penalty...

anyway you get the idea.... please could somebody inform me on the best way to do this, it has to be stored as a time so I can add all the stages up later and create a report!

Thanks in advance...

neileg
02-11-2008, 01:50 AM
You could use a date/time datatype but this can cause problems as this is based on zero being 31/12/1899.

It may be easier to store the times as numbers of seconds and convert these for display purposes. This may make the maths easier.

puafo
02-24-2008, 02:01 AM
Sorry for the late reply been away, getting back into it now.
Can anyone point me in the right direction, I have searched the web but not found any constructive help on this matter.

how do i convert it to the number?
how do i store time as a number?
how do i convert it back again?

I have a very limited knowledge of access (it shows) and want the person to be able to enter the stage time into a text box and store it as a number, what is the best way to do this?

Do they separate the time using . ?

If they are entering just seconds do they have to enter the 00.00.10 for ten seconds?

If someone could point me to an example of the code required I may be able to work it out from there!

gemma-the-husky
02-24-2008, 02:52 AM
i would have thoght that as long as the times are less than 24hrs (therefore awkward for a stage race - would need a bit of playing) you could just store the time

you enter it as 1:24:12 I think

access will store this as 1:24:12 on 30th December 1899, but as you are not bothered about the date, you can just use the time

storing penalties is a bit of a relational issue

dateadd will let you add time penalties in seconds

dateadd("s", penalty, basetime)