PHP gmdate find out if it's been a year

800

I was just wondering how you would be able to find out if something is x amount old. My problem is that I want to find out if this item is a year old, but I'm using unix timestamp. I convert it using gmdate so that it's read-able. Next, I try to compare it to 3600, but it's not working.

Here's my code below.

$unix_timestamp = 1373058307;
$gmdate = gmdate("m/d/Y", $unix_timestamp);
echo $gmdate;

if($gmdate >= 3600) {
    echo "<br>1 year already";
} else {
    echo "<br>Hasn't been a year yet";
}

The echo $gmdate is just to test what date it's on. And I get 07/05/2013 which is the correct date I'm looking for. Now since it's 2015, I want to compare it so that it says 1 year already. I know I should check to see if it's 2 years, but this particular thing I'm doing only needs to be checked if it's a year or more.

I'm not sure if I'm doing it right.

People are also looking for solutions to the problem: html - Implementing AJAX into a PHP page with multiple selections

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.