$currentDate = CRM_Utils_Date::isoToMysql(date('c')); $formattedDate = CRM_Utils_Date::mysqlToIso($currentDate); echo CRM_Utils_Date::format($formattedDate, null, 'd/m/Y'); // Output: 01/01/2022
$timestamp = time(); $formattedDate = CRM_Utils_Date::setFromUnix($timestamp); echo CRM_Utils_Date::format($formattedDate, null, 'd/m/Y'); // Output: 01/01/2022In the first example, we get the current date in the ISO format, convert it to MySQL format, and then format it to the desired output format (dd/mm/yyyy). In the second example, we use the `setFromUnix` function to convert a timestamp to a formatted date. Overall, CRM_Utils_Date is a convenient package for working with dates and timestamps in PHP, specifically within the context of CiviCRM.