I want to add 2 seconds for current date object, I am getting data objects as propel foreach array result, this is the object I receive
DateTime Object
(
[date] => 2020年05月22日 09:03:21.000000
[timezone_type] => 3
[timezone] => Australia/Melbourne
)
I tried this ways but no any change,
$row->getStartTime()->add(DateInterval::createFromDateString('+2 seconds'));
$row->getStartTime()->add(new DateInterval('PT2S'));
But I am unable to get the new with 2 seconds added for received time.
asked May 22, 2020 at 6:23
user2552863
5095 gold badges10 silver badges20 bronze badges
1 Answer 1
$time = $row->getStartTime()->format('H:i:s');
$callTimeMax = date('H:i:s', strtotime('+3 seconds', strtotime($time)));
This is my approach, It worked.
answered May 22, 2020 at 7:08
user2552863
5095 gold badges10 silver badges20 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-php
$row->getStartTime()->add- does your foreach use references for$row?