1 date.class.inc public BackdropDateTime::limitGranularity($granularity)

Removes unwanted date parts from a date.

In common usage we should not unset timezone through this.

Parameters

array $granularity: An array of date parts.

File

core/includes/date.class.inc, line 368

Class

BackdropDateTime
Extends PHP DateTime class for use with Backdrop.

Code

public function limitGranularity($granularity) {
  foreach ($this->granularity as $key => $val) {
    if ($val != 'timezone' && !in_array($val, $granularity)) {
      unset($this->granularity[$key]);
    }
  }
}