使用库进行转换日期

问题描述:

I am using a library for converting Gregorian date to my country's date.
Following code is an example of my coding :

Include_once("jdf.php");
$test_date = "2018-09-09 06:00:00";
$changed_date = jdate('Y-m-d H:i:s', strtotime($test_date));
echo $changed_date;

But when I use this for database rows, just Y-m-d become convert.
Following code is my script:

try {
    $stmt = $conn->prepare("SELECT date as table_date FROM api_table;");
    $stmt->execute();
    Include("jdf.php");
        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            extract($row);
            $convert_date = jdate("Y/m/d H:i:s", strtotime($table_date));
            echo $convert_date;
        }
} catch (PDOException $e) {
        echo "Error: " . $e->getMessage();
}

Can you help me guys ??

Just set timezone :

date_default_timezone_set("Asia/Tehran");