0

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));
5
  • 1
    Show us a valid value for $article["added"] Commented Feb 5, 2014 at 14:50
  • probably $article["added"] comes from the database and it has value 0 (or NULL or empty) in the live environment? Commented Feb 5, 2014 at 14:51
  • If $srticle['added'] is valid then I think it should work. see here Commented Feb 5, 2014 at 14:54
  • No the value is 1391610991, which I've tested on a unix converter too Commented Feb 5, 2014 at 14:56
  • So if its already a timestamp then why are you using strtotime on it? Commented Feb 5, 2014 at 14:57

1 Answer 1

2

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

$article_added = date('l jS F Y', $article["added"]);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.