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.
Project information
- Project categories: Content editing experience
2 sites report using this module
- Created by vivek_lnwebworks on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.




