Should I store a time as datetime in my db?

I have a field that is going to hold a time. Since Rails “knows” the
MySQL type datetime, should I use that instead of the type “time” and
just leave the feild portions of datetime blank?

Second Question:
What I am really trying to do is save a day of the week and time in a
field i.e. Sunday 7:00pm
Right now I have a varchar holding the day of the week seperate from
the time. Is this the best way to do this, yes?

Thanks everyone for the help!


I’m no expert, but I would suggest using the datetime field type,
saving the date/time in full (, and then writing two methods
in your model that return the day of the week and the time formatted as
you wish.

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