This module calculates working days between two dates, determines an end date based on a start date and a number of working days, and can identify working or free days within a specific month.
Calculate Working Days
----------------------------------
Calculate Working Days is a module that allows you to calculate working days
between 2 dates or the final date given an initial date
and the number of working days.
It also can calculate which days in a month are free or working days.
CONTENTS OF THIS FILE
-----------------------------------
* Introduction
* Requirements
* Installation
* Configuration
* Maintainers
REQUIREMENTS
-----------------------
This module requires a date picker library.
INSTALLATION
---------------------
*Install as you would normally install a contributed Drupal module. Visit
[Installing Modules](https://www.drupal.org/docs/extending-drupal/installing-modules) for further information.
CONFIGURATION
-------------------------
To use:
1. Navigate to Administration > Extend > And Search
for Calculate Working Days Module
2. Enable the working days Module.
3. Go to URL "/admin/config/regional/calculate-working-days"
4. Do the configuration for free days of the week.
5. Enter the day month and special occasions.
FUNCTIONS OVERVIEW
---------------------------------
1. calculate_working_days_get_work_days
Description:
Calculates the number of working days between two given dates (inclusive).
Arguments:
$start_date (int): The starting date as a Unix timestamp.
$final_date (int): The ending date as a Unix timestamp.
Returns:
(int): Number of working days between the two dates.
Example Usage:
$start_date = strtotime('2025-01-01');
$final_date = strtotime('2025-01-10');
$work_days = calculate_working_days_get_work_days($start_date, $final_date);
2. calculate_working_days_get_work_days_monthly
Description:
Calculates the number of working days in a specified month and year.
Arguments:
$month (int): The month (1 for January, 12 for December).
$year (int): The year (must be greater than 1970).
Returns:
(int): Number of working days in the given month and year.
Example Usage:
$month = 1; // January
$year = 2025;
$work_days = calculate_working_days_get_work_days_monthly($month, $year);
3. calculate_working_days_get_free_days_monthly
Description:
Calculates the number of free days (non-working days) in a specified month and year.
Arguments:
$month (int): The month (1 for January, 12 for December).
$year (int): The year (must be greater than 1970).
Returns:
(int): Number of free days in the given month and year.
Example Usage:
$month = 1; // January
$year = 2025;
$free_days = calculate_working_days_get_free_days_monthly($month, $year);
4. calculate_working_days_get_end_date
Description:
Calculates the end date given a start date and a number of working days.
Arguments:
$start_date (int): The starting date as a Unix timestamp.
$days (int): The number of working days to calculate.
Returns:
(int): The calculated end date as a Unix timestamp.
Example Usage:
$start_date = strtotime('2025-01-01');
$days = 10;
$end_date = calculate_working_days_get_end_date($start_date, $days);Notes
Timestamp Requirement: All date-related arguments are required to be Unix timestamps for consistency.
Error Handling: Validate input arguments before passing them to these functions to avoid unexpected results.
Ask your assistant about Calculate Working Days
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 2.0.3 | Stable | 8–10 | Sep 1, 2026 | ||
| 2.0.2 | Stable | 8–10 | Nov 23, 2023 | ||
| 2.0.0 | Stable | 8–10 | Nov 23, 2023 | ||
| 2.0.x-dev | Dev | 8–10 | Nov 23, 2023 | ||
| 1.0.3 | Stable | 8–9 | Nov 17, 2023 | ||
| 1.0.2 | Stable | 8–9 | Nov 17, 2023 | ||
| 1.0.1 | Stable | 8–9 | Nov 17, 2023 | ||
| 1.0.0 | Stable | 8–9 | Nov 16, 2023 | ||
| 1.0.x-dev | Dev | 8–9 | Nov 16, 2023 |