Storing seconds, retrieving sensible data

I want to construct a time period, i.e. say a user has 1 month, 3 days
and 10 hours to do something. I want to store this information in a
database, and instead of storing this information in 3 fields, I want
to store it in one.
I have 3 select boxes, one for Month, Days, and Hours, and I’m using
“before_save” to convert the selected value into seconds.

However, when I retrieve the information from the database what would
be the best way to retrieve the Month, Days and Hours information
again?

Thanks in advance.

Store it as a datetime field and then use distance_of_time_in_words to
work
out how long the user has to do it.

On Dec 17, 2007 9:44 AM, Luke G. [email protected] wrote:

again?

Thanks in advance.


Ryan B.
http://www.frozenplague.net

or you could read my other reply here:

http://railsforum.com/viewtopic.php?pid=48008#p48008

On Dec 17, 2007 10:12 AM, Ryan B. [email protected] wrote:

to store it in one.


Ryan B.
http://www.frozenplague.net


Ryan B.
http://www.frozenplague.net

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs