Welcome Guest, Not a member yet? Register   Sign In
insert in to TIMESTAMP field using ActiveRecords
#2

[eluser]Michael Wales[/eluser]
The now() function within the date helper returns a Unix timestamp. First, I highly, highly, recommend you use Unix timestamps instead of MySQL timestamps - it will make your life much easier.

If you insist though... try this:

Code:
$profile_data = array(
              'member_id' => $member_id ,
              'membername' => $membername ,
              'profiledescription' => '' ,
              'lastlogin' => date('Y-m-d H:i:s', now()),
              'status' => 1,
                );

PHP's date() function accepts a string representing a format for the date and an optional Unix timestamp, for the timestamp you would like to convert into the strings representation.


Messages In This Thread
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-25-2007, 01:59 PM
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-25-2007, 02:04 PM
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-25-2007, 02:08 PM
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-25-2007, 02:24 PM
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-26-2007, 07:44 AM
insert in to TIMESTAMP field using ActiveRecords - by El Forum - 09-26-2007, 07:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB