Jump to content

add time to datetime


nadeemshafi9

Recommended Posts

int mktime  ([ int $hour= date("H")  [, int $minute= date("i")  [, int $second= date("s")  [, int $month= date("n")  [, int $day= date("j")  [, int $year= date("Y")  [, int $is_dst= -1  ]]]]]]] )

 

 

$thetme='00:00:10';
$justTime=mktime(substr($thetime,0,2),substr($thetime,3,2),substr($thetime,6,2),0,0,0);
$dateTime=strtotime('0000-00-00 11:11:00');
$addedtogether=$dateTime+$justTime;
echo date('d-M-Y H:i:s',$addedtogether);

 

See how that works.

Link to comment
https://forums.phpfreaks.com/topic/152224-add-time-to-datetime/#findComment-799375
Share on other sites

int mktime  ([ int $hour= date("H")  [, int $minute= date("i")  [, int $second= date("s")  [, int $month= date("n")  [, int $day= date("j")  [, int $year= date("Y")  [, int $is_dst= -1  ]]]]]]] )

 

 

$thetme='00:00:10';
$justTime=mktime(substr($thetime,0,2),substr($thetime,3,2),substr($thetime,6,2),0,0,0);
$dateTime=strtotime('0000-00-00 11:11:00');
$addedtogether=$dateTime+$justTime;
echo date('d-M-Y H:i:s',$addedtogether);

 

See how that works.

 

thnaks man il try it out tommorow

Link to comment
https://forums.phpfreaks.com/topic/152224-add-time-to-datetime/#findComment-799756
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.