4

I need to store "time" in a content type. The time is actually duration (how long it took people to perform various tasks), with the time varying between a few minutes to several days.

Is there anything already out there (Date doesn't seem to cover it)?

If not, what's the best way to create this?

Ideally I'd like dropdowns for days, hours, minutes, seconds, tenths.

It seems to make sense to store a computed value in the database (total seconds, rather than save everything in five separate fields. Are there any good tutorials on doing this?

I assume I then use a field formatter to break out 300.3 seconds into 6:00.3 or whatever format I want?

1 Answer 1

4

Sounds like you're looking for something like Time Period.

That one stores the interval in seconds, so if you need smaller values you will probably have to write your own field widget/formatter but the module might still serve as a base.. or maybe you could extend it to cover this use case as well and e.g. store microseconds.

1
  • Great, thanks. Like you say, it doesn't cover my exact use case as I do need tenths, but I can either submit a patch for it or use it as a base for my own custom module.
    – Apemantus
    Mar 27, 2012 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.