3060 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 279 Views |
-
SS3 ORM filter by Created date

21 September 2012 at 8:52am
Could somebody please help me figure out how to make a ORM sql query on a dataobject that returns the count of dataobjects created today. Cant figure it out in the new SS3 ORM.
-
Re: SS3 ORM filter by Created date

21 September 2012 at 11:07am Last edited: 21 September 2012 2:03pm
Found a solution that seems to work:
DB::query("SELECT count(*) FROM Invoice WHERE Created BETWEEN '".date('Y-m-d')." 00:00:00' AND '".date('Y-m-d')." 23:59:59'")->value()
And that seems to be the right way$count = Invoice::get()->filter(
array(
'Created:GreaterThan' => date('Y-m-d').' 00:00:00',
'Created:LessThan' => date('Y-m-d').' 23:59:59'
)
)->count();
| 279 Views | ||
|
Page:
1
|
Go to Top |

