On Apr 19, 8:23 am, mivogt-LU <[email protected]> wrote: > Hi there, > > I would like to know if there is (and if then how to do) a way to > manipulate data from datetimefields. > I am doing a bookingsystem. Arrival is ment to be at 13:00, leave at > 10 :00. > > I use datetime fields in the views and database. > Now before saving I would like to always set the arrival to 12 and the > leave to 10 o clock. > > This for I know I ll need to split up the datetime, manip it and > rejoin it. > Shure this might be done by stringmanipulation and concatenation, too.
Could you try explaining that again? Do you mean that you want to change just the time portion of the datetime field? If so, look at PHP's date/time functions: http://www.php.net/manual/en/ref.datetime.php Specifically, strtotime() will take your datetime field as input and give you a timestamp. That can then be used with, eg. date() to output in a different format. Or, you can use it to change portions of the datetime field to something else. $dt = '2010-04-19 01:19:32'; // change time to 4pm: $dt = date('Y-m-d 16:00:00', strtotime($dt)); Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
