无法在php中添加当前时间

I am unable to add random days hours minutes and seconds to the current date.

Here is my code-

$randnos=rand(0,30);
$randhrs=rand(00,24);
$randmin=rand(00,60);
$randsec=rand(00,60);    

$newTime = date("d/m/Y H:m:s",strtotime(" +'.$randnos.' days" . " +'.$randhrs.' Hours". " +'.$randmin.' minutes". " +'.$randsec.' seconds"));

update_post_meta($post_id,'test',$newTime);

Problem in the string used in strtotime().

$randnos=rand(0,30);
$randhrs=rand(00,24);
$randmin=rand(00,60);
$randsec=rand(00,60);    
$str = ' +'.$randnos.' days +'.$randhrs.' Hours  +'.$randmin.' minutes +'.$randsec.' seconds';
$newTime = date("d/m/Y H:m:s",strtotime($str));

Create the string first with random data, then insert in strtotime().

Your quote marks are all messed up.

$randnos=rand(0,30);
$randhrs=rand(00,24);
$randmin=rand(00,60);
$randsec=rand(00,60);    

$newTime = date("d/m/Y H:m:s",strtotime("+$randnos days +$randhrs hours +$randmin minutes +$randsec seconds"));

update_post_meta($post_id,'test',$newTime);

One-liner

echo date('Y-m-d h:i:s', strtotime('+' .rand(30, 60 * 60 * 24 * 3).' seconds'));
$randnos = rand(0,30);
$randhrs=rand(00,24);
$randmin=rand(00,60);
$randsec=rand(00,60);    
$sec =  $randsec + ($randmin * 60) + ($randhrs * 60 * 60 ) + ($randnos * 60 * 60 * 24);
$newTime = date("d/m/Y H:m:s",strtotime(date("r")) + $sec );