PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.0.3
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.0.3
5.13.0 5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Intl / Data / Provider / DateTimeFormatProvider.php
matomo / app / core / Intl / Data / Provider Last commit date
CurrencyDataProvider.php 2 years ago DateTimeFormatProvider.php 2 years ago LanguageDataProvider.php 2 years ago RegionDataProvider.php 2 years ago
DateTimeFormatProvider.php
81 lines
1 <?php
2
3 /**
4 * Matomo - free/libre analytics platform
5 *
6 * @link https://matomo.org
7 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
8 */
9 namespace Piwik\Intl\Data\Provider;
10
11 /**
12 * Provides date and time formats.
13 */
14 class DateTimeFormatProvider
15 {
16 const DATETIME_FORMAT_LONG = 1;
17 const DATETIME_FORMAT_SHORT = 2;
18 const DATE_FORMAT_LONG = 10;
19 const DATE_FORMAT_DAY_MONTH = 11;
20 const DATE_FORMAT_SHORT = 12;
21 const DATE_FORMAT_MONTH_SHORT = 13;
22 const DATE_FORMAT_MONTH_LONG = 14;
23 const DATE_FORMAT_YEAR = 15;
24 const TIME_FORMAT = 20;
25 /**
26 * Returns the format pattern for the given format type
27 *
28 * @param int $format one of the format constants
29 *
30 * @return string
31 */
32 public function getFormatPattern($format)
33 {
34 switch ($format) {
35 case self::DATETIME_FORMAT_LONG:
36 return 'EEEE, MMMM d, y HH:mm:ss';
37 case self::DATETIME_FORMAT_SHORT:
38 return 'MMM d, y HH:mm:ss';
39 case self::DATE_FORMAT_LONG:
40 return 'EEEE, MMMM d, y';
41 case self::DATE_FORMAT_DAY_MONTH:
42 return 'E, MMM d';
43 case self::DATE_FORMAT_SHORT:
44 return 'MMM d, y';
45 case self::DATE_FORMAT_MONTH_SHORT:
46 return 'MMM y';
47 case self::DATE_FORMAT_MONTH_LONG:
48 return 'MMMM y';
49 case self::DATE_FORMAT_YEAR:
50 return 'y';
51 case self::TIME_FORMAT:
52 return 'HH:mm:ss';
53 }
54 return $format;
55 }
56 /**
57 * Returns if time is present as 12 hour clock (eg am/pm)
58 *
59 * @return bool
60 */
61 public function uses12HourClock()
62 {
63 return false;
64 }
65 /**
66 * Returns interval format pattern for the given format type
67 *
68 * @param bool $short whether to return short or long format pattern
69 * @param string $maxDifference maximal difference in interval dates (Y, M or D)
70 *
71 * @return string
72 */
73 public function getRangeFormatPattern($short = false, $maxDifference = 'Y')
74 {
75 if ($short) {
76 return 'MMM d, y – MMM d, y';
77 }
78 return 'MMMM d, y – MMMM d, y';
79 }
80 }
81