0

Hello,

I have a problem to get unique values from dateperiod-loop.

There is a tons of examples how to do it, but after hours of searching, i couldn't find suitable solution for me.
The code starts like this. To put it into array_unigue is hard to accomplish for me.

Have you any simple proposals to make it working?

$intrvl =  strtotime("1970-01-01 00:30:00 UTC");

$dateTimes = new DatePeriod(
new DateTime($starttime),
new DateInterval('PT'.$intrvl.'S'),
new DateTime($endtime)
);

foreach ($dateTimes as $dt) {

    $start=$dt->format('H.i');
    $end=date('H.i',strtotime('+30 minutes',strtotime($start)));

    echo'<div>'.$start.' - '.$end.'</div>';

}
3
Contributors
4
Replies
20
Views
1 Month
Discussion Span
Last Post by benanamen
0

So I dropped your code as-is on http://phpfiddle.org and has issues that stopped me from seeing what it does.

Now that I tried that, you'll have to explain in detail what you need. Consider this as if you are outsourcing a project and detail it enough that others can write the function.

Or fix your code to run on http://phpfiddle.org

0

I also have no idea what you want. Rather than talk about your attempt at solving the problem, explain to us the big picture of what you are doing,

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.