Khong_biet
|
Posted: 07/30/2004, 9:46 PM |
|
Please help me to convert string to Date format
When I select data from table, dateopinion is date format and when show to web it is running but date format is yyyy-mm-dd
How can I change date format to dd/mm/yyyy
Thank
My code:
global $Docreceive_Docattribute_K;
global $ngay_y_kien;
// Write your own code here.
$tam=$Docreceive_Docattribute_K->Docattribute_docid->getvalue();
$db = new clsDBConnection2();
$SQL= "SELECT docid, opinion, dateopinion, lastname FROM Opinion INNER JOIN Employee ON
Opinion.username = Employee.username";
$db->query($SQL);
$temp="";
while ($db->next_record())
{
$docid=$db->f("docid");
if ($docid==$tam)
{
$ngay_tam =$db->f("dateopinion");
$nguoi_tam = $db->f("lastname");
$y_kien = $db->f("opinion");
$temp = $temp."-->.": ".$nguoi_tam.": ".$y_kien."; ";
}
}
$Docreceive_Docattribute_K->ykien->SetValue($temp);
$db->close();
|
|
|
hidran
Posts: 29
|
Posted: 08/02/2004, 9:06 AM |
|
use date_format(dateopinion,'%m /%d/%Y) in your query
or in php str_replace('-','/',$ngay_tam)
|
|
|
|