Tuesday, 18 February 2014

Filled Under:

How to compare two dates in php

                   in this post i have explain that how to compare two dates in php. so don't worry you can easily compare two dates in php using below date_compare() function which i was created.

function date_compare($dat1, $dat2)
    $dat1 = explode('_', $dat1);
    $dat2 = explode('_', $dat2);

    $dat1 = array_reverse($dat1);
    $dat2 = array_reverse($dat2);

    if (strtotime(implode('-', $dat1)) > strtotime(implode('-', $dat2)))
        return $dat2;
        return $dat1;


Post a Comment