我们想要获取上个月的用户积分记录。 我们有用户创建日期例如。 2015 年 8 月 25 日。 第二个表是用户积分。
But Main Thing is : -
if current date is 23-11-2015
我们想要点表中的记录:-
上个月:2015年9月25日至2015年10月25日
当前月份:2015年10月25日至2015年11月25日
if current date is 28-11-2015
我们想要点表之间的红线:-
上个月:2015年10月25日至2015年11月25日
当前月份:2015年11月25日至2015年12月25日
Note: Means User Created date is starting user month and end of user month
最佳答案
您可以执行以下操作:
function get_day_for_date($date)
{
$day = date('d', strtotime($date));
return $day;
}
$user_reg = "25-08-2015";
$current_month_start = get_day_for_date($user_reg) ."-". date("m-Y", strtotime("-1 months"));
$current_month_end = get_day_for_date($user_reg) ."-". date("m-Y");
$last_month_start = get_day_for_date($user_reg) ."-". date("m-Y", strtotime("-2 months"));
$last_month_end = get_day_for_date($user_reg) ."-". date("m-Y", strtotime("-1 month"));
//echo $current_month_start . ", ". $current_month_end;
//echo "<br>";
//echo $last_month_start . ", ". $last_month_end;
关于php - 获取codeigniter事件记录中用户的上个月和当月记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33866081/