Announcement

Collapse
No announcement yet.

PHP ORM Where Clause - Date Only, Ignore Time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP ORM Where Clause - Date Only, Ignore Time

    How can I filter (using the EspoCRM PHP functions) a date-time field by the date only - ignoring the time part?

    Code:
    $list = $this->getEntityManager()->getRepository($entityType)->where([
    'date(createdAt)' => date("Y-m-d")
    ]);
    The above doesn't seem to work at all.
    Last edited by blueprint; 01-23-2020, 08:08 AM.

  • #2
    Resolved!

    Use the "LIKE" operator which is "*" in EspoCRM. Thus:

    Code:
    $list = $this->getEntityManager()->getRepository($entityType)->where([
    'createdAt*' => date("Y-m-d %:%:%")
    ]);
    Works just fine.
    Last edited by blueprint; 01-23-2020, 08:08 AM.

    Comment


    • #3
      'DAYOFMONTH:createdAt' => date('Y-m-d')

      https://github.com/espocrm/documenta...expressions.md

      Comment

      Working...
      X