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:
authorThomas Steur <thomas.steur@gmail.com>2014-01-09 00:42:16 +0400
committerThomas Steur <thomas.steur@gmail.com>2014-01-09 00:42:16 +0400
commit32f40ab9525256f1f7654d54f3307a4e9e1bc7c4 (patch)
treefc6fafeb3a494b042bbf2f0b1c9f818744aa580d /core/Date.php
parent44eef274c25fa2563fed4a99bb3c01b9ce9a61ad (diff)
refs #1486 added method to detect whether current year is a leap year
Diffstat (limited to 'core/Date.php')
-rw-r--r--core/Date.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/Date.php b/core/Date.php
index 3b21ed186a..063420940c 100644
--- a/core/Date.php
+++ b/core/Date.php
@@ -290,6 +290,18 @@ class Date
}
/**
+ * Returns `true` if the current year is a leap year, false otherwise.
+ *
+ * @return bool
+ */
+ public function isLeapYear()
+ {
+ $currentYear = date('Y', $this->getTimestamp());
+
+ return ($currentYear % 400) == 0 || (($currentYear % 4) == 0 && ($currentYear % 100) != 0);
+ }
+
+ /**
* Converts this date to the requested string format. See {@link http://php.net/date}
* for the list of format strings.
*