Question:
I'm working on a CMS to display articles, my problem is with the strtotime()
function does not indicate the correct date, it always indicates March 1, 1970. The row (phpMyAdmin) of one of the article_timestamp
is given with the formatting: ex. 1394220287
. What am I doing wrong?
<span id="date">Publicado
<?php
setlocale(LC_ALL, NULL);
date_default_timezone_set('Europe/Lisbon');
$timeStamp = $article['article_timestamp'];
$uppercaseMonth = ucfirst(gmstrftime('%B'));
echo strftime( '%A, %d de ' .$uppercaseMonth. ' de %Y', strtotime($timeStamp));
?></span>
Answer:
From the example you added to the question, I see that $timeStamp
is already a timestamp
, so strtotime() is not needed.
Use only:
echo strftime( '%A, %d de ' .$uppercaseMonth. ' de %Y', $timeStamp);
// ^^ - tirei o strtotime()