I use date(DATE_ATOM) for date / timestamp fields, one could argue
that there might be different time-zone between the web-server and the
db server :-) If you really need the DB timestamp, better using '!-
NOW()' as Stephen mentionned.

On May 22, 4:35 pm, fr3nch13 <[EMAIL PROTECTED]> wrote:
> Most likely uses php's time (didn't check), but a good reason for this
> is to allow supporting of multiple databases (or even flat files)
> instead of db specific functions.
>
> On May 22, 10:25 am, Zifnab <[EMAIL PROTECTED]> wrote:
>
> > Ok, well for consistency's sake, do you know if cakePHP's automatic
> > filling of 'created', 'updated', and 'modified' fields uses PHP's time
> > or MYSQL's time?  Thanks for all the quick responses everyone :)
>
> > On May 22, 7:11 am, djiize <[EMAIL PROTECTED]> wrote:
>
> > > yes you're right!
> > > I care about that because we have 1 MySQL central server and several
> > > servers that request it.
> > > And we have not always full control of theses servers (apps can be
> > > coded by others teams/companies).
>
> > > On 22 mai, 14:16, Joel Perras <[EMAIL PROTECTED]> wrote:
>
> > > > It doesn't really matter whether or not you obtain the date from
> > > > Apache/PHP or MySQL; as long as you are consistent.
>
> > > > On May 22, 4:01 am, djiize <[EMAIL PROTECTED]> wrote:
>
> > > > > I use the same way as Stephen
> > > > > Because what if MySQL is hosted on another server than Apache/PHP ?
> > > > > You'll save Apache/PHP time which can be different of MySQL time (no
> > > > > the same meridian for instance).
> > > > > Of course, it's a very specific case.
> > > > > And my servers are time synchronised together, but some time
> > > > > differences appeared once or twice a year.
>
> > > > > On 22 mai, 07:47, Stephen Orr <[EMAIL PROTECTED]> wrote:
>
> > > > > > I believe I used this method:
>
> > > > > > 'last_login' => '!-NOW()'
>
> > > > > > Which makes Cake stop trying to quote it. But I'm pretty sure the
> > > > > > latest SVN revision recognises NOW() and doesn't quote it anyway.
> > > > > > Maybe I'm confused.
>
> > > > > > Steve
>
> > > > > > On May 22, 2:12 am, Alex Ciobanu <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Zifnab wrote:
> > > > > > > > I'm trying to figure out how to implicitly make a mysql NOW() 
> > > > > > > > call
> > > > > > > > when doing a model save...here's an example of the code:
>
> > > > > > > > $aUserData = array(
> > > > > > > >     'User'  =>  array(
> > > > > > > >         'id' => 4,
> > > > > > > >         'last_login' => 'NOW()'
> > > > > > > >     )
> > > > > > > > );
>
> > > > > > > > $this->User->save( $aUserData, false, array( 'last_login' ) );
>
> > > > > > > > Naturally the save doesn't work, because NOW() saves as a string
> > > > > > > > "NOW()" instead of as a mysql function NOW()....How do I get it 
> > > > > > > > to
> > > > > > > > save as a mysql function?
>
> > > > > > > $aUserData['User']['last_login'] = date("Y-m-d H:i:s");
> > > > > > > $this->User->save($aUserData);
>
> > > > > > > Not using NOW(), but does the trick.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to