Skip to content
Jan Hermann edited this page Oct 19, 2026 · 1 revision

⏳

Leap year checks in PHP, Java and JavaScript: namespace Timely\Years, Java package timely.years.

Helper

The same class and method names in every language:

  • Helper.php, Helper.java and YearHelper.js (Timely.Helper, see JavaScript).
  • isLeap(year): Checks if the year is leap using the Gregorian rules (divisible by 4, except centuries not divisible by 400).
  • isLeap2(year): The same using a library function (java.time.Year.isLeap() in Java, Converter in JavaScript, date("L") in PHP).
use Timely\Years\Helper;

Helper::isLeap(2000); // true
Helper::isLeap(1900); // false
Timely.Helper.isLeap(2024); // true

Try it in the Examples (examples/years.html).

Clone this wiki locally