在跳过假期+乔达时间的同时计算结束日期 [英] Calculating end date while skipping holidays + Joda time

查看:84
本文介绍了在跳过假期+乔达时间的同时计算结束日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算事件的结束日期(和时间).我知道开始日期持续时间(以分钟为单位).但是:

I would like to calculate end date (and time) of an event. I know starting date and duration (in minutes). But:

  1. 我不得不跳过假期-非经常性情况
  2. 我不得不跳过周末-反复出现的情况
  3. 我不必计算工作时间(例如:从8:00 am到5:00 pm)-重复出现的情况,但粒度要细些
  1. I have to skip holidays - non-recurrent situation
  2. I have to skip weekends - recurrent situation
  3. I have to not count working time (e.g: from 8:00am till 5:00pm) - recurrent situation, but with finer granularity

是否有使用Joda时间库实现这些情况的简单方法?

Is there a simple way to achieve these cases using Joda time library?

推荐答案

Jodatime会帮到您-我会说很多-但您需要自己编写逻辑,这会跳过一整天有时的一天.在我看来,不是很简单,也不是很复杂.

Jodatime will help you -a lot I'd say-, but you'll need to write the logic yourself, a loop skipping some entire days and some times of the day. Not very simple, neither very complex, it seems to me.

这篇关于在跳过假期+乔达时间的同时计算结束日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆