Subject: Object to string
Hi, I'm getting this error in PHP page with mysql dB connection: Warning: strtotime() expects parameter 1 to be string, object given in ... on line 36
at the 36th line i get: $lastaccess = strtotime($info['lastaccess']);
where $info is ...
$info = array(); $user = User::find($userid); $info['lastaccess'] = $user->lastaccess;
My question is... how can i get the string instead of object in the last line of code? Thank you
P.S. in the dB lastaccess is "date" type
date and datetime fields are converted to DateTime objects so if you wanted the unix timestamp you can do $user->lastaccess->getTimestamp();
(1-1/1)
June 27 2010
December 20, 2010 00:00
Subject: Object to string
Hi, I'm getting this error in PHP page with mysql dB connection:
Warning: strtotime() expects parameter 1 to be string, object given in ... on line 36
at the 36th line i get:
$lastaccess = strtotime($info['lastaccess']);
where $info is ...
$info = array();
$user = User::find($userid);
$info['lastaccess'] = $user->lastaccess;
My question is... how can i get the string instead of object in the last line of code?
Thank you
P.S. in the dB lastaccess is "date" type