Sanctions may not be awarded under CCP 128.7 unless the party to be sanctioned has been given a full 21 days in which to withdraw the offending pleading.  The 21 days are calculated by omitting the day on which notice of the proposed sanctions motion is served and including the last day.  So the earliest the sanctions motion can be filed in court is on the 22nd day after service.  Sanctions also cannot be awarded if the court rules on the offending pleading within the 21 day period for withdrawal.  Here, the trial court denied plaintiff’s attorney fee motion on the 21st day after defendant gave notice of its intent to seek sanctions.  Plaintiff didn’t get the full 21 days to withdraw its motion.  So sanctions were properly denied.