date - PHP Convert timestamp to months and days -


How do I change a timestamp difference between 2 dates

  $ diff = abs (Strtotime ($ 2 date) - Strottom ($ 1 date);  

Quantity of months and days as desired output:

  $ res = 4.05 // - & gt; 4 months and 5 days  

Something might possibly work, my math might be a little far away .

  $ diff = abs (Straotomem ($ date2) - Strottom ($ 1 date); Define ('DAY', 60 * 60 * 24, true); Define ('MONTH', DAY * 30, true); Define ('YEAR', DAY * 365, true); $ Years = floor ($ variant / (YEAR)); $ Months = floor (($ difference - $ year * year) / (month)); $ Day = floor (($ difference - $ year * year - $ months * monthly) / (days));  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -