This topic is locked
[SOLVED]

 date format in code snippet

8/18/2014 3:50:38 PM
PHPRunner General questions
D
droogers author

Hello,
I have a php code snippet.



global $dal, $strTableName;

echo "Info weekend:
";

if ($_SESSION[$strTableName."_masterkey1"])

{

$tblOrders = $dal->Table("tbldata_conferenties");

$rs = $tblOrders->Query("ID=".$_SESSION[$strTableName.

"_masterkey1"],"");

if ($data = db_fetch_array($rs))

{

echo "Van: ".$data["Datum_van"]."
";

echo "Tot: ".$data["Datum_tot"]."
";

}

}



["Datum_van"] and ["Datum_tot"] shows a date field with the format yyyy-mm-dd. I want to change it in the format dd-mm-yyyy. How do I do this ?

Sergey Kornilov admin 8/19/2014

Use PHP date() function for this purpose i.e.

date("Y-m-d H:i:s", strtotime($data["Datum_van"]));


More info:

http://php.net/manual/en/function.date.php