Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/Date.php')
-rw-r--r--core/Date.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/core/Date.php b/core/Date.php
index 82a3df42a6..a214751b8e 100644
--- a/core/Date.php
+++ b/core/Date.php
@@ -41,7 +41,7 @@ class Date
/** The default date time string format. */
const DATE_TIME_FORMAT = 'Y-m-d H:i:s';
-
+
/** Timestamp when first website came online - Tue, 06 Aug 1991 00:00:00 GMT. */
const FIRST_WEBSITE_TIMESTAMP = 681436800;
@@ -155,7 +155,7 @@ class Date
$date = new Date($dateString);
}
$timestamp = $date->getTimestamp();
-
+
if ($timestamp < self::FIRST_WEBSITE_TIMESTAMP) {
$dateOfFirstWebsite = new self(self::FIRST_WEBSITE_TIMESTAMP);
$message = Piwik::translate('General_ExceptionInvalidDateBeforeFirstWebsite', array(
@@ -165,7 +165,7 @@ class Date
));
throw new Exception($message . ": $dateString");
}
-
+
if (empty($timezone)) {
return $date;
}
@@ -986,6 +986,20 @@ class Date
}
/**
+ * Adds `$n` Month to `$this` date and returns the result in a new Date.
+ * instance.
+ *
+ * @param int $n Number of days to add, must be > 0.
+ * @return \Piwik\Date
+ */
+
+ public function addMonth($n)
+ {
+ $ts = strtotime("+$n month", $this->timestamp);
+ return new Date($ts, $this->timezone);
+ }
+
+ /**
* Adds `$n` hours to `$this` date and returns the result in a new Date.
*
* @param int $n Number of hours to add. Can be less than 0.