如何在任何持续时间内两次创建约会 [英] how to create appointment between two times with any duration time

查看:71
本文介绍了如何在任何持续时间内两次创建约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在两次之间创建约会,每次约会都会有差距或持续时间



例子



从时间:上午10:00

到时间:下午2:00



持续时间为20分钟

时间将如下所示



上午10:00第一次预约

上午10:20第二次预约

上午10点40分第3次约会

上午11:00第4次预约

等等..

i want to create appointment between two times and in each appointment there will be a gap or duration

example

from time: 10:00 am
to time: 2:00 pm

duration between time is 20 minutes
time will be shown like below

10:00 am 1st appointment
10:20 am 2nd appointment
10:40 am 3rd appointment
11:00 am 4th appointment
and so on..

推荐答案

尝试这样的事情:

Try something like this:
DateTime startTime = DateTime.Parse("10:00");
DateTime endTime = DateTime.Parse("14:00");
TimeSpan duration = new TimeSpan(0, 20, 0);
List<DateTime> appointments = new List<DateTime>();
while (startTime < endTime)
    {
    appointments.Add(startTime);
    startTime += duration;
    }

以20分钟的间隔建立一个约会列表。

That builds a list of appointments at 20 minute intervals.


这篇关于如何在任何持续时间内两次创建约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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