PHP: Check if it has been one week since timestamp

Posted by Rudi on Stack Overflow See other posts from Stack Overflow or by Rudi
Published on 2010-05-16T19:14:05Z Indexed on 2010/05/16 19:20 UTC
Read the original article Hit count: 134

Filed under:

Hi guys,

Let's assume:

$time = '2010-05-17 02:49:30' // (retrieved from MySQL TIMESTAMP field)

How do I do the following in PHP:

1) Check if it has been more than one week since this time has passed?

2) Assuming "false" on (1), find out how much more time until the one week mark, rounded to days and hours remaining.

I know this is pretty straightforward, but it uses a very specific syntax. Having never played with time calculations before, I'd appreciate some guidance.

Thanks!

© Stack Overflow or respective owner

Related posts about php