Work day searching method and device, storage medium and equipment

A technology of working days and binary search method, applied in the field of data processing, can solve the problems of large database load and low calculation efficiency, and achieve the effect of fewer holidays, reduced traversal time, and fast calculation.

CN110263231AInactive Publication Date: 2019-09-20重庆颂拓科技有限公司
0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Publication Date
2019-09-20
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure 1
    Figure 1
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and discloses a workday searching method and device, a storage medium and equipment, and the method comprises the steps: S1, reading a user configuration file, extracting holidays and festivals from the user configuration file, and sequentially storing the holidays and the festivals to form a holidays and festival sequence; S2, respectively positioning the positions of the start date and the end date in the holiday sequence, and counting the number of the holidays and the holidays between the start date and the end date; and S3, subtracting the number of holidays and festivals from the total number of days between the start date and the end date to obtain the number of working days between the start date and the end date. According to the method, a database does not need to be accessed, traversing of each workday is not needed, the number of holidays and festivals is relatively small, traversing time is greatly shortened, and therefore the number of the workdays can be rapidly calculated.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The present invention relates to the technical field of data processing, and in particular to a method, device, storage medium and equipment for finding workdays. Background technique

[0002] The traditional working day calculation method is: directly based on java.util.Calendar to judge the working days within the start and end time range, that is, after giving the start date and end date, search in sequence to calculate the number of working days. The advantage of this algorithm is that it is simple in logic and can be calculated without additional data configuration. But the actual situation is that you may have to work on weekends, and non-weekends may be holidays. Therefore, this calculation method is only applicable to the situation without additional holidays.

[0003] Based on the above reasons, a general enterprise will design a calendar table at the beginning to record working days and holidays, and provide a functional interface for users ...

Examples

Embodiment Construction

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

[0026] The weekday search method in this embodiment is as follows: figure 1 shown, including:

[0027] Step S1, read the user configuration file and extract holidays from it, store the holidays sequentially to form a holiday sequence. Among them, the calendar data in the database is not divided into workdays and holidays. After the user configures, one piece of data per day is used to distinguish between workdays and holidays through a flag field, such as: 1 indic...