Jump to content

[SOLVED] Days Calculation


graham23s

Recommended Posts

Hi Guys,

 

i can't seem to get this what im trying to do is work out the elapsed time in DAYS from 2 dates code is:

 

             $time_now = time();
             $d2 = date('Y-m-d H:i:s', $time_now);
             $d1 = date('Y-m-d H:i:s', strtotime($ng_date));
             $days = ceil(($d1 - $d2) / (60 * 60 * 24));

 

when echoing out it produces:

 

2007-06-02 16:53:24
2007-08-27 18:00:51

 

which is right, but $days echoes out as 0.

 

can anyone help lol

 

cheers

 

Graham

Link to comment
https://forums.phpfreaks.com/topic/66912-solved-days-calculation/
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.