mysql昨天、今天、今天以前.txt /** * sql条件语句:今天内付款 * @param string $field [description] * @return string sql */function yestoday_sql($field = 'pay_time'){ $t_yestoday = date('Y-m-d',strtotime("-1 day")); return
/** * sql条件语句:今天内付款 * @param string $field [description] * @return string sql */ function yestoday_sql($field = 'pay_time'){ $t_yestoday = date('Y-m-d',strtotime("-1 day")); return "date_format(from_UNIXTIME(`{$field}`),'%Y-%m-%d')='{$t_yestoday}'"; } /** * 今天 * @param string $field 字段名 * @return string sql */ function today_sql($field){ $t_today = date('Y-m-d', strtotime("today")); return "date_format(from_UNIXTIME(`{$field}`),'%Y-%m-%d')='{$t_today}'"; } /** * 今天以前 * @return string sql */ function history_sql($field='reg_time'){ return "DATE_FORMAT(FROM_UNIXTIME(`{$field}`),'%Y-%m-%d')