What is the best column time to store amount of hours

For example, if I want to store the amount of hours a service takes to
complete such as...

1 hour of consulting
2 hours of consulting
3 hours of consulting

1 hour swedish massage
1.5 hours swedish massage

If it was all whole hours I could just use integer, but note I also need
it for half hours.

TABLE: services
name:string
duration: ???

I tried using time, but since my development database is sqlite3, the
datatype it uses it's datetime and stores the current date.

Store minutes, and use an integer field? In your model divide by 60 in
the getter, and multiply by 60 in the setter (or expect minutes as the
parameter) to give you the hours (and this lets you easily do
quarter-hour increments when the feature-creep comes :wink:

Leonel Leonel wrote:

For example, if I want to store the amount of hours a service takes to
complete such as...

1 hour of consulting
2 hours of consulting
3 hours of consulting

1 hour swedish massage
1.5 hours swedish massage

If it was all whole hours I could just use integer, but note I also need
it for half hours.

TABLE: services
name:string
duration: ???

I tried using time, but since my development database is sqlite3, the
datatype it uses it's datetime and stores the current date.

But your production database won't be SQLite, because SQLite is
unsuitable for production. In any case, there's nothing wrong with
storing times in a datetime field and disregarding the date.

However, that's not what you need here. You're storing time
*intervals*, not clock times. And you yourself spoke of "1.5 hours"
above. That suggests that a float or decimal type is what you want.

Best,

I guess you guys are right. I wanted to avoid the conversation if
possible but your suggestions seem to be the way to go.

Thanks :slight_smile: