将时间段插入一系列时间段 [英] Insert a time period into a sequence of time periods

查看:85
本文介绍了将时间段插入一系列时间段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有一系列时间段......



从6:00 AM到7:30

7:30 AM到8 :00 AM

8:00 AM至8:30

8:30 AM至10:00



和我想要插入一段时间,请说



上午7:45至8:15



这样...... 。

1.序列的开始时间保持不变(早上6:00)

2.序列的结束时间保持不变(上午10:00)

3.总持续时间保持不变(4小时)

4.插入期间的开始和结束时间保持不变。



使用上面的例子,我希望......



6:00 AM到7:30

7 :上午30点至早上7:45

上午7:45至8:15

8:15 AM至8:30

8:30 AM至10: 00AM



Thx

Suppose we have a sequence of time periods...

6:00AM to 7:30AM
7:30AM to 8:00AM
8:00AM to 8:30AM
8:30AM to 10:00AM

and I want to insert a period, say

7:45AM to 8:15AM

such that...
1. The start time of the sequence remains the same (6:00AM)
2. The finish time of the sequence remains the same (10:00AM)
3. The total duration remains the same (4 hours)
4. the start and finish time of the inserted period remains the same.

Using the example above I would expect...

6:00AM to 7:30AM
7:30AM to 7:45AM
7:45AM to 8:15AM
8:15AM to 8:30AM
8:30AM to 10:00AM

Thx

推荐答案

看看时间段李brary for .NET [ ^ ] ,CP上最好的文章之一。

学习它的代码肯定会为你提供有关你自己要求的线索。
Have a look at Time Period Library for .NET[^], one of the best articles on CP.
Studying its code will for sure give you clues about your own requirement.


这篇关于将时间段插入一系列时间段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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