Add in unit test of searching when price field value label has changed
[civicrm-core.git] / CRM / Utils / Date.php
index 24b2f7388072276ff11abec6307c7d3a34ba6b84..fa96fca47fa1a0394a2bd4cd7b6c781a3101d498 100644 (file)
@@ -2204,4 +2204,17 @@ class CRM_Utils_Date {
     }
   }
 
+  /**
+   * Print out a date object in specified format in local timezone
+   *
+   * @param DateTimeObject $dateObject
+   * @param string $format
+   * @return string
+   */
+  public static function convertDateToLocalTime($dateObject, $format = 'YmdHis') {
+    $systemTimeZone = new DateTimeZone(CRM_Core_Config::singleton()->userSystem->getTimeZoneString());
+    $dateObject->setTimezone($systemTimeZone);
+    return $dateObject->format($format);
+  }
+
 }