How to implement a simple project time log

Hello!

I want to add simple project time log features to my yii project. Therefore I have an ActiveRecord to store the log entries. It has the following attributes:

date

person_id

project_id

duration

The duration should be typed as 00:10 for ten minutes, 01:00 for one hour and so on.

How can I handle input validation (valid inputs for duration), and what field type should I use in MySQL? How can I handle the (atomatic) conversation between the stored (some number?) and visualized (hh:mm) duration-values?

Or is there a better way for input of the duration value?

I hope someone can help me…

Thanks in advance

Thomas

just track timestamps - always. one for begin and one for end. In your view you can use http://de.php.net/manual/en/function.date.php to format these timestamps accordingly.

… or if you don’t need start/end times, simply save total minutes as INT in your db. You may need to convert back and forth in beforeSave() and afterFind() in your AR.

Thanks Mike, that’s exactly how I did it in the meantime. I store the duration in minutes. Start and End times are not neccessary. I use a masked input field in the form.

Greets

Thomas