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?

    $list = $this->getEntityManager()->getRepository($entityType)->where([
    'date(createdAt)' => date("Y-m-d")
    ]);

    The above doesn't seem to work at all.

  • #2
    Resolved!

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

    $list = $this->getEntityManager()->getRepository($entityType)->where([
    'createdAt*' => date("Y-m-d %:%:%")
    ]);

    Works just fine.

    Comment


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

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

      Comment

      Working...
      X