From: Matthew Wire Date: Tue, 1 Nov 2022 14:04:02 +0000 (+0000) Subject: APIv4 - Add DATEDIFF to calculate days between two dates X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9649b73a0ce805d729a3b8c6b2d53f74aaa07b94;p=civicrm-core.git APIv4 - Add DATEDIFF to calculate days between two dates Co-authored-by: colemanw --- diff --git a/Civi/Api4/Query/SqlFunctionDATEDIFF.php b/Civi/Api4/Query/SqlFunctionDATEDIFF.php new file mode 100644 index 0000000000..cc5a6862a5 --- /dev/null +++ b/Civi/Api4/Query/SqlFunctionDATEDIFF.php @@ -0,0 +1,48 @@ + 2, + 'min_expr' => 2, + 'optional' => FALSE, + 'label' => ts('diff'), + ], + ]; + } + + /** + * @return string + */ + public static function getTitle(): string { + return ts('Days between two dates'); + } + + /** + * @return string + */ + public static function getDescription(): string { + return ts('Number of days between two dates.'); + } + +}