Saturday, 15 May 2010

PHP gmdate find out if it's been a year -


I was thinking how you would know that if something x is old, my problem is that I have to find out That this item is one year old, but I am using the Unix timestamp. I convert it using gmdate so that it is readable. After this, I try to compare it to 3600, but it is not working.

Here's my code below.

  $ unix_timestamp = 1373058307; $ Gmdate = gmdate ("m / d / y", $ unix_timestamp); Echo $ gmdate; If ($ gmdate> = 3600) {resonant "
from 1 year ago"; } And {resonant "& lt; br & gt; not yet a year"; }

The echo $ gmdate is just to determine what is on that date and I get 07/05/2013 which is the exact date that I am looking for. Now since 2015, I want to compare it so that it can be told 1 year ago. I know I have to see that this is 2 years, but this particular thing is that I should check only for one year or more.

I'm not sure if I am doing this is okay.


No comments:

Post a Comment