I need to add the time / date to the previous one.

I did this:

$f = getdate(strtotime($start_date)); $duration = 1000; //любое число в секундах $end_date = date('YmdHis O', mktime( $f['hours'], $f['minutes'], $f['seconds'] + $duration, $f['mon'], $f['mday'], $f['year'] )); 

Is there any way to simplify or shorten this code?

    1 answer 1

    Because the date in PHP is stored in UNIX format, i.e. is the number of seconds that have passed since January 1, 1970, then simply add to the date the desired number of seconds

     $f = strtotime($start_date); $duration = 1000; //любое число в секундах $end_date = $f + $duration; 
    • How simple it turned out :) - Telion