I'm trying to filter the data collection from 4 hours to now and I have the below code but its not working.
public function getWishlistProduct($wishlistid){
$to = date("Y-m-d h:i:s");
$from = strtotime('-4 hours', strtotime($to));
$from = date('Y-m-d h:i:s', $from);
$wishlist= $this->getCollection()->addFieldToFilter('wishlist_id', ['eq'=>$wishlistid])
->addFieldToFilter('added_at', array('from'=>$from, 'to'=>$to));
return $wishlist;
}
Could anyone please help?