Page 1 of 1
How to get Date ?
Posted: Tue Jun 08, 2010 8:44 am
by tamilmani
Hi ,
Here is my var_dump result. I need the get the date from this result . How i get this ?
Code: Select all
array(1) { [0]=> object(stdClass)#67 (6) {
["number"]=> int(21)
["ID"]=> int(6)
["Description"]=> string(9) "Day"
["PDate"]=> object(DateTime)#66 (3) {
["date"]=> string(19) "2010-04-25 00:00:00"
["timezone_type"]=> int(3)
["timezone"]=> string(13) "Asia/Calcutta"
}
["pid"]=> int(6)
["pname"]=> string(26) "Test"
} }
Any suggestion please ?
Re: How to get Date ?
Posted: Tue Jun 08, 2010 9:38 am
by AbraCadaver
Re: How to get Date ?
Posted: Tue Jun 08, 2010 12:28 pm
by tamilmani
Hi Dude,
There is no luck for this code. I don't get anything. Still i have this issue.
Re: How to get Date ?
Posted: Tue Jun 08, 2010 12:36 pm
by AbraCadaver
tamilmani wrote:Hi Dude,
There is no luck for this code. I don't get anything. Still i have this issue.
Works for me. You need to have error reporting on, post your code and post the error.
Re: How to get Date ?
Posted: Tue Jun 08, 2010 1:42 pm
by tamilmani
I retrive the datas from table . I am using micrsoft sql server . PDate (field type is datetime)
Code: Select all
if (isset($result)){ if ($result!= ""){
foreach ($result as $row)
{
$phid = $row->PNumber;
$pid = $row->ID;
$pname = $row->pname;
$description = $row->Desc;
$datetime = $row->PDate;
}
}}
when i print the $datetime . I am getting error message like as
Code: Select all
A PHP Error was encountered
Severity: 4096
Message: Object of class DateTime could not be converted to string
Re: How to get Date ?
Posted: Tue Jun 08, 2010 1:45 pm
by AbraCadaver
Re: How to get Date ?
Posted: Tue Jun 08, 2010 1:57 pm
by tamilmani
I used above code . I am getting error message. Anything need to change in php.ini ????
Code: Select all
A PHP Error was encountered
Severity: Notice
Message: Undefined property: DateTime::$date
Re: How to get Date ?
Posted: Tue Jun 08, 2010 2:19 pm
by AbraCadaver
tamilmani wrote:I used above code . I am getting error message. Anything need to change in php.ini ????
Code: Select all
A PHP Error was encountered
Severity: Notice
Message: Undefined property: DateTime::$date
No. I can't see a problem.