You could calculate the time difference on the fly with mysql TIMEDIFF function [http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timediff] instead of store it in the db.... And this [http://www.gidnetwork.com/b-16.html] may help to store the time difference.
Céryl escribió: > Hej all! > > Since my good advice just ago, I got to another bottleneck. > > I have a form in which the user selects two times (a start- and an end- > time). The form works perfectly and the times get stored in the table > as hh:mm:ss. > > However, I have a 3th row in the database that must hold the elapsed > time between the two form-inputted times. I want the computer to > calculate this. I figured I must do this in in the controller, I can > of course even do after the $this->Model->save() action with a > saveField, just before the redirect. > > However, I cannot seem to find a good example of making that function. > I'm not sure how i get my timestamp back from the form, if they are > simply substractable and how to store it back in the table. > > If it makes matters easier, elapsed time can be stored as an integer > holding seconds between times in the table, I can probably calculate > those back in elapsed minutes/hours in a later view of the table. > > Any idea's or links to examples of working with Timestamps? It always > boggles me! > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
