Thursday, 17 July 2014

Compare date in php

It’s really a horrible thing to work on date to being a programmer. If language is PHP then it’s too hard to achieve but don’t worry I have a best trick to solve it just take a look on following lines.

In PHP Date store in string format internally and time is store integer internally. You just have to change date into its equivalent time integer value and compare their integer as we work on number.

function compare_date($d1,$d2)
echo "First Date is greatest one";
echo "Second Date is greatest one";

I am using function for implement your logic you can work it where you want without using function 

No comments:

Post a Comment