Jump to content

Working With Dates


vicodin

Recommended Posts

Hello all i am trying to compare dates and find out if the person signed up this month or before this month. So i came up with this and it works but was wondering if there was a better way to do it.

 

$signup = "2008-10-09";//<-- What ever date is pulled from DB
$date = date("Y/m");
$date.= "/01";
$date = strtotime($date);
$signup = strtotime($signup);
if ($signup > $date){
echo 'Signed Up This Month';
} else {
echo ' Signed Up Before';
}

Link to comment
https://forums.phpfreaks.com/topic/134707-working-with-dates/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.