$date = '2022-01-15'; $timestamp = CRM_Utils_Date::formatDate($date, 'Ymd'); echo $timestamp; // output: 20220115
$date1 = '2022-01-15'; $date2 = '2022-01-18'; $days = CRM_Utils_Date::getInterval($date1, $date2, '%a'); echo $days; // output: 3The getInterval method is used to calculate the number of days between two dates. The third argument (%a) specifies the format of the interval, in this case, days. Package Library: The CRM_Utils_Date class is part of the CiviCRM package library. CiviCRM is a web-based, open-source CRM software that is specifically designed for non-profit, civic sector, and advocacy organizations. The package library contains various classes, functions, and utilities that are used to build CiviCRM applications.