Domanda

I have a website that logs the date of an article posted as a timestamp and converts it to full date. Testing this on localhost works fine but on the live version it displays the date as:

31st December 1969

Here is the code that I'm using:

$article_added = $article["added"];
$article_added = date('l jS F Y', strtotime($article_added));
È stato utile?

Soluzione

Your date is already a timestamp so no need to use strtotime()

$article_added = date('l jS F Y', $article["added"]);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top