Swati Dhamale Swati Dhamale - 1 year ago 65
MySQL Question

Compare only day and month without year in php ex. birth date

I want to compare current date's day and month with subscription date's day and month only.
ex.current date(d-m) = 3-6 and I want compare it with any other d-m

How should i do it in php
In my project condition is like birth date in which we don't compare year.

Please help me out.
Thanks in advance.

Answer Source

use like

$current_date = date("d-m");
$subscription = "03-06-2016";
$subscription_date  = date("d-m", strtotime($subscription));
if($current_date ==$subscription_date)
    echo "date is equal";
    echo "date is not equal";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download