Jump to content

date diffrence help


redarrow

Recommended Posts

 

how can i set the time diffrence for 10 sec please tried everthink.

 

please trie to use the folllowing example but correctly formatted cheers.

<?php

$date_now=strtotime(date("s"));
$date_dif=strtotime(date("s"))-10;

echo "$date_now <br> $date_dif";

if($date_now - $date_dif){

echo "done";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/38884-date-diffrence-help/
Share on other sites

why dosent this work very strange please help.

 

alter the code but no joy.

<?php

$date_now=strtotime(date("d-m-y","h:i:s"));
$date_dif=strtotime(date("d-m-y","h:i:s"))-2;

echo "$date_now <br> $date_dif";

if($date_now < $date_dif){

echo "done";
}

?>

Link to comment
https://forums.phpfreaks.com/topic/38884-date-diffrence-help/#findComment-186993
Share on other sites

you could also use this longer method.

 

$NewTime = mktime(Date("H"), Date("i"), Date("s")+10, Date("m"), Date("d"), Date("Y"));

//you can now subtract from current time or do whatever with $NewTime

 

echo Date("Y-m-d H:i:s").'(old)<br>'.Date("Y-m-d H:i:s", $NewTime).'(new)';

Link to comment
https://forums.phpfreaks.com/topic/38884-date-diffrence-help/#findComment-187013
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.