Oluşturulan tarihe ve "dün" oluşturulan het girişlerine göre filtrelemek istediğim özel bir koleksiyonum var
Koleksiyon Girişleri
//dates are set in controller using
setCreatedTime(Mage::getModel('core/date')->gmtDate());
Dün oluşturuldu (çalışmıyor)
//3 products items Yesterday
//below filtering outputs incorrect entries
$collection = Mage::getModel('things/things')->getCollection();
Denedim, ancak yanlış girişler çıktı;
//thought strtotime('yesterday') would work..
$collection->addFieldToFilter('created_time', array('gt' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('yesterday'))));
$collection->addFieldToFilter('created_time', array('gt' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('-1 day'))));
$collection->addFieldToFilter('created_time', array('from'=> strtotime('-1 day', time()),'to'=> time(),'datetime' => true));
$fromDate = date('Y-m-d H:i:s', strtotime($fromDate));
$toDate = date('Y-m-d H:i:s', strtotime($toDate));
$collection->addFieldToFilter('created_time', array('from'=>$fromDate, 'to'=>$toDate));
Bugün Oluşturuldu (şimdiki gün) (çalışıyor)
//5 products items today with timestamp 2016-05-01 05:22:53
//below filtering outputs correct entries
$collection = Mage::getModel('things/things')->getCollection();
$collection->addFieldToFilter('created_time', array('gt' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('today'))));
Geçen hafta oluşturuldu (eserler)
//23 products items with timestamps for this week
//below filtering outputs correct entries
$collection = Mage::getModel('things/things')->getCollection();
$collection->addFieldToFilter('created_time', array('gt' => Mage::getModel('core/date')->date('Y-m-d H:i:s', strtotime('-1 week'))));