W3cubDocs

/Drupal 8

protected property DateFormatter::$units

Contains the different date interval units.

This array is keyed by strings representing the unit (e.g. '1 year|@count years') and with the amount of values of the unit in seconds.

Type: array

File

core/lib/Drupal/Core/Datetime/DateFormatter.php, line 68

Class

DateFormatter
Provides a service to handle various date related functionality.

Namespace

Drupal\Core\Datetime

Code

protected $units = array(
  '1 year|@count years' => 31536000,
  '1 month|@count months' => 2592000,
  '1 week|@count weeks' => 604800,
  '1 day|@count days' => 86400,
  '1 hour|@count hours' => 3600,
  '1 min|@count min' => 60,
  '1 sec|@count sec' => 1,
);

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Datetime!DateFormatter.php/property/DateFormatter::units/8.1.x