Comparing two date / times to find out if 5 mins has lapsed between the two times php
Posted
by estern
on Stack Overflow
See other posts from Stack Overflow
or by estern
Published on 2010-06-10T00:32:52Z
Indexed on
2010/06/10
0:42 UTC
Read the original article
Hit count: 229
I need to compare two dates to show an edit link if it is within 5 mins after the post was made, in php. If after 5 mins dont show anything.
$answer_post_date = get_the_time("Y-m-d");
$current_date = date("Y-m-d");
$formated_current_date = strtotime($answer_post_date);
$formated_answer_post_date = strtotime($current_date);
At this point i have two values:
1274414400 ($formated_current_date) 1276056000 ($formated_answer_post_date)
I am not sure what to do next to check if the current date/time is !> 5 mins from answer post date.
Any suggestions would be great
All i really need the answer to be is a Boolean (yes/no) and if yes display the minuets left to show the link to edit.
© Stack Overflow or respective owner