Java calculates the number of days before two dates (excluding holidays and weekends)

As mentioned in the question, calculate the number of days before two dates, excluding holidays and weekends. The type of days here is double, because this function is used to calculate the number of days of leave, and the number of days of leave in the morning is 0.5 days.

What's not enough is that you have to query the database every day, which feels like a waste of time.

principle:

  1. Holidays are stored in the database

Implementation steps:

  1. Cycle each date

  2. Judge whether each date is a holiday or weekend

  3. Days + 1 if not holidays and weekends

code:

The above example of Java calculating the number of days before two dates (excluding holidays and weekends) is all the content shared by Xiaobian. I hope it can give you a reference and support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>