Good day. Faced the problem of displaying the date. The database in the files table has a date column in the timestamp format. It means 2017-07-20 09:32:23
When I do a sample
$sql = "SELECT * from files where id= $i"; // $i итерационная переменная $stmt = $db->prepare($sql); $result = $stmt->fetch(PDO::FETCH_ASSOC); $date=date('F/j/Y',strtotime($result['date']));
And I’m echo "<p>Дата:'$date'</p>";
Displays 'January / 1/1970'
Tell me, please, where was I wrong? Can you tell me how to format the timestamp correctly so that it displays the exact time the file was uploaded to the server? When tried $date=$result['date']; , echo didn’t produce anything except quotes. Also experimented with sql query: id = 1, SELECT * - nothing helped.
$result['date']is exactly the date you need - Al Mr