V
V
v170s2020-08-30 17:38:29
PHP
v170s, 2020-08-30 17:38:29

How to print timestamp from MySQL + PHP?

Good afternoon! There is a string in the MySQL database 5f4bb8ca5cead898470917.png
And here is its value in the database itself: 5f4bb8efb7a07000221004.png

When using the following code, the date will be 01.01.1970 03:00:00

$date = strtotime($existingInfo["RegisterDate"]);
echo date('d.m.Y H:i:s', $date);

I am using RedbeanPHP if that matters.
Question: How to correctly echo the date?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2020-08-30
@v170s

if($existingInfo["RegisterDate"])) {
    echo (new DateTimeImmutable($existingInfo["RegisterDate"]))->format('d.m.Y H:i:s');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question