php - How to get exact average of n number of order in m number of months? -
example:
$difference = strtotime($to) - strtotime($from); $months = ($difference / 86400 / 30 );
problem: way never exact average. because can’t sure 30 days there can 31 , 28 days months also.
even tried divide 12 month average can’t work in every month selection cases read first , change according ur own
you can number of days month in year using function:
php manual - cal_days_in_month
you can number of days whole year using, example, solution:
finding total number of days in year
also, if want number of days current month, can use this:
date("t");
Comments
Post a Comment