Answer the question
In order to leave comments, you need to log in
How to add dynamic date to timestamp?
Hello!
There was a problem, and something I can not understand how to solve it.
It is required to dynamically add a certain number of hours or minutes to the current timestamp.
I have:
foreach ($items as $item) {
$time = strtotime(date("d-m-Y H:i:s", time()+3600));
}
Answer the question
In order to leave comments, you need to log in
Why is strtotime here? You apparently tried to write:
foreach( $items as $item ) {
$time = time() + 3600;
}
You most likely have an error in the body of the loop. Not a telepath, but most likely it should be something like this:
foreach ($items as $item) {
$item = strtotime(date("d-m-Y H:i:s", time()+3600));
}
foreach ($items as $item) {
$item['time'] = strtotime(date("d-m-Y H:i:s", time()+3600));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question