I'm having a problem regarding comparing two dates. I know this sound kinda silly but I want you all to try this example.

```
$a = date('d-m-Y', strtotime('2014-07-03'));
$b = date('d-m-Y', strtotime('2014-03-17'));
$c = date('d-m-Y', strtotime('2015-03-16'));

if(($a > $b)  && ($a < $c) ) {
    echo "1";
}
else {
    echo "2";
}

```

How come the result is 2?
['https://Stackoverflow.com/questions/24556316', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3802062/']
Your "logic" is wrong.

![xkcd](https://imgs.xkcd.com/comics/iso_8601.png)  

> [xkcd](http://xkcd.com/1179/)

```
$a = '2014-07-03';
$b = '2014-03-17';
$c = '2015-03-16';

if(($a > $b) && ($a < $c)) {
    echo "1"; // it works!
}

```

Big-endian formats are awesome.
Because your date format is *not* good for comparing. Always use YYYY-MM-DD format when comparing dates (or use DateTime() objects). This is because 04-01-2014 is less than 05-01-2014 when compared as strings.

```
$a = '2014-07-03';
$b = '2014-03-17';  
$c = '2015-03-16';  

if(($a > $b)  && ($a < $c) ) {
    echo "1";
}
else {
    echo "2";
}

```

Or when using DateTime() objects:

```
$a = new DateTime('2014-07-03');
$b = new DateTime('2014-03-17');
$c = new DateTime('2015-03-16');

if(($a > $b)  && ($a < $c) ) {
    echo "1";
}
else {
    echo "2";
}

```