php date function

来源:互联网 发布:帆盛点胶机编程 编辑:程序博客网 时间:2024/05/16 10:01
private function whereDate($s,$e,$col="dateline") {      $where = 'AND ';      if(!empty($s) and !empty($e)) {          $where .= "`$col` >= '{$s}' AND `$col` <= '{$e}' ";      } elseif (!empty($s) AND empty($e)) {          $now = time();          $where .= "`$col` >= '{$s}' AND `$col` <= '{$now}' ";      } elseif (empty($s) AND !empty($e)) {          $time = time()-86400;          $where .= "`$col` >= '{$time}' AND `$col` <= '{$e}' ";      } else {          $where = "";      }      return $where;  }