📅
Date utilities in PHP, Java and JavaScript: namespace Timely\Dates, Java package timely.dates.
## [Helper](https://github.com/hermajan/time/blob/master/src/timely/dates/Helper.php)
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](Holidays.md).
```php
use Timely\Dates\Helper;
use Timely\Holidays\Slovak\SlovakFinder;
Helper::nextWorkingDay(new \DateTime("2026-04-02"), new SlovakFinder()); // 2026-04-07
```
## [Date](https://github.com/hermajan/time/blob/master/src/timely/dates/Date.java)
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]`.
## [DateUtil](https://github.com/hermajan/time/blob/master/src/timely/dates/DateUtil.js)
JavaScript class `Timely.DateUtil`, see [JavaScript](JavaScript.md):
- `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`.
## [Week](https://github.com/hermajan/time/blob/master/src/timely/dates/Week.js)
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`).
```js
Timely.DateUtil.dayOfWeek(Timely.Week.en); // "Monday"
```
Try it in the [Examples](Examples.md) (`examples/dates.html`).