In your /app/config/bootstrap.php file, before the ending ?> (if the file contains one), use the following PHP code:
date_default_timezone_set('America/New_York'); You can find your OWN area's timezone by checking the examples from http://php.net/timezones - just switch the string in the function call with your own timezone. It *should* fix the inserted datetime to be what you expect. On Apr 13, 12:56 pm, brian <bally.z...@gmail.com> wrote: > Perhaps your server is running in a different timezone than you are. > > On Mon, Apr 13, 2009 at 2:45 AM, gaurav.v.sharma > > > > <gaurav.v.sha...@gmail.com> wrote: > > > Thanks a lot, it worked perfectly fine :-) .... But the "time part" in > > the created field is not having the correct value for current time ... > > what should be done in that case... > > > On Apr 12, 9:23 pm, brian <bally.z...@gmail.com> wrote: > >> Change the field name to "created" and add another named, "modified". > >> Both of them should be defined like so: > > >> DATETIME DEFAULT NULL > > >> Cake will then set the value when/where appropriate. > > >> On Sun, Apr 12, 2009 at 2:05 AM, gaurav.v.sharma > > >> <gaurav.v.sha...@gmail.com> wrote: > > >> > Hi all :-), > > >> > I have created a small application using the bake command. While > >> > designing the database for the application I created a column named > >> > "creationdate" in every table so as to record the date and time of > >> > that operation. > > >> > I donot allow user to enter this "creationdate" value infact I have > >> > created the column attribute as "on Update set current timestamp" and > >> > the datatype as timestamp. This is handled by mysql itself and the > >> >creationdateis automatically filled with current date and time > >> > whenever an insert operation is performed on the table. > > >> > Earlier (when I was not using cakephp framework) these values were > >> > updated automatically but now that I have started using cakephp these > >> > values are going as null in the database. > > >> > What should I do when I want to update the "creationdate" column > >> > automatically whenever an insert/update operation is performed. > > >> > I am using XAMPP v 1.7.0 which is having following version of > >> > apache,mysql and php > >> > * Apache HTTPD 2.2.11 > >> > * MySQL 5.1.30 > >> > * PHP 5.2.8- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---