搜索日期过滤中的更改日期格式

时间:2018-08-02 07:53:26

标签: magento-1.9

当我使用过滤搜索日期范围时,日期格式为

  

2018年8月1日晚上7:30:00   但是我想要Y / m / d格式,但我不知道该怎么做,我的'filter_condition_callback'是`受保护的函数_filterSearchUpdatedAt($ collection,$ column)       {

    $value = $column->getFilter()->getValue();

    if (isset($value['from'])) {
        $from = $value['from'];
    } else $from = '';

    if (isset($value['to'])) {
        $to = $value['to'];
    } else $to = '';

    if ($to != '' and $from != '') {
        $collection->getSelect()->where("`cust`.`time_update` >=$from and `cust`.`time_update` <= $to");

    } elseif ($from != '') {

        $collection->getSelect()->where("`cust`.`time_update` >=$from");
    } elseif ($to != '') {

        $collection->getSelect()->where("`cust`.`time_update`<=$to");
    }
    $this->setCollection($collection);
    return $this;
}`

0 个答案:

没有答案