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

📅

Date utilities in PHP, Java and JavaScript: namespace Timely\Dates, Java package timely.dates.

PHP class Timely\Dates\Helper with date comparison and working-day calculations:

  • sameDates($dateTime1, $dateTime2): Compares two dates ignoring time.
  • between($first, $second, ?$dateTime): Checks if the date (now by default) is between two dates.
  • isWeekend($dateTime), isWorkingDay($dateTime, $holidays).
  • nextWorkingDay($dateTime, $holidays), addWorkingDays($dateTime, $days, $holidays): Skip weekends and holidays; a negative number of days goes back.

The $holidays argument is a Timely\Holidays\Finder, see Holidays.

use Timely\Dates\Helper;
use Timely\Holidays\Slovak\SlovakFinder;

Helper::nextWorkingDay(new \DateTime("2026-04-02"), new SlovakFinder()); // 2026-04-07

Java class timely.dates.Converter for conversions between Gregorian and Julian calendar systems:

  • gregorianToJulian(int day, int month, int year): Converts a Gregorian calendar date to Julian calendar date, returning [day, month, year].
  • julianToGregorian(int day, int month, int year): Converts a Julian calendar date to Gregorian calendar date, returning [day, month, year].

JavaScript class Timely.DateUtil, see JavaScript:

  • formatDate(date): Returns the date in day.month.year format (today by default).
  • dayOfWeek(lang, date): Returns the name of the day of the week using Timely.Week.cs or Timely.Week.en.

JavaScript class Timely.Week with cs and en arrays of the days of the week, indexed as in Date.getDay() (the same data is in week.json).

Timely.DateUtil.dayOfWeek(Timely.Week.en); // "Monday"

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

Clone this wiki locally