This article mainly introduces PHP to determine how many months between the two date method, involving the PHP operation date of the relevant skills, the need for friends can refer to the following
This example describes how PHP determines how many months are different between two dates. Share to everyone for your reference. The implementation method is as follows:
/** * @author Injection (injection.mail@gmail.com) * @var date1 date 1* @var date2 date @var Tags month and day separator mark, default to '-' * @return phase The number of months of poor * @example: $date 1 = "2003-08-11"; $date 2 = "2008-11-06"; $monthNum = Getmonthnum ($date 1, $date 2); Echo $monthNum; */f Unction Getmonthnum ($date 1, $date 2, $tags = '-') {$date 1 = explode ($tags, $date 1); $date 2 = Explode ($tags, $date 2); return a BS ($date 1[0]-$date 2[0]) * + ABS ($date 1[1]-$date 2[1]);}