druybew06513 2014-05-20 11:31
浏览 9

PHP在其中几个中拆分单个DateTime

Let's say I have an event that starts on 2014-05-20 09:00 and ends on 2014-05-20 17:00! What I want is to be able to split this event in two, say the break hours are 11:00 - 12:00 (which are stored as datetimes actually) and it would result into 4 datetimes:

2014-05-20 09:00 – 2014-05-20 11:00
2014-05-20 12:00 – 2014-05-20 17:00

I could have several break hours that split the event into many sub-events.

My idea is to sort the break hours datetimes and use the first break hour end time as the end start for the 1st subevent or vice versa depending when the break hour is. But there is a lot of calculation to be done here this way, isn't there a simpler way?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向