A
A
Alexander N++2015-10-26 14:33:37
PHP
Alexander N++, 2015-10-26 14:33:37

How to make the interval from the current time -10 minutes to -50 minutes?

Where am I dumb?

echo $currentDate= date('Y-m-d H:m:s');
        echo "<br>";
        echo $date1 = date('Y-m-d H:m:s', time() - (60*60) ); 
        echo "<br>";
        echo $date2 = date('Y-m-d H:m:s', time() - (60*10) );

Result
2015-10-26 15:10:25
2015-10-26 14:10:25
2015-10-26 15:10:25

$currentDate = date('Y-m-d H:m:s');
        echo $currentDate;
        echo "<br>";
        echo $date1 = date('Y-m-d H:m:s', strtotime('-50 minutes', strtotime($currentDate)) );
        echo "<br>";
        echo $date2 = date('Y-m-d H:m:s', strtotime('-11 minutes',strtotime($currentDate)) );

And again the same result
Experiment number 3
$currentDate = date('Y-m-d H:m:s');
        $dateStart = new \DateTime($currentDate);
        $dateStart = $dateStart->modify('-50 minutes')->format('Y-m-d H:m:s');

        $dateEnd = new \DateTime($currentDate);
        $dateEnd = $dateEnd->modify('-10 minutes')->format('Y-m-d H:m:s');

        echo "$currentDate <br>";
        echo "$dateStart <br>";
        echo "$dateEnd <br>";

Well, again too.
Tell me where I am stupid
and how can I make Between from -50 of the current date to -10 from the current date
Mushrooms are such mushrooms
они растут и радуют меня
я вырастил грибы
они растут, а остальное все фигня
@Хабиасс - Грибы

The date format is Ymd H:m:s should be Ymd H:i:s
Sorry to bother you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2015-10-26
@sanchezzzhak

This is where the error Y-m-d H:m:smust be.Y-m-d H:i:s

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question