surajkandukuri Posted October 19, 2009 Share Posted October 19, 2009 Hi all, I have 3 numbers 13 years, 13 months, 31 days I would like to convert that into Exact years, months and days to 14years 2months 1 day. Please tell me how to convert this. Quote Link to comment https://forums.phpfreaks.com/topic/178246-solved-convert-13years-13months-and-31-days-into-14years-2-months-and-1days/ Share on other sites More sharing options...
Mark Baker Posted October 19, 2009 Share Posted October 19, 2009 $wrk = mktime(0,0,0,$months,$days,2000+$years); $years = date('Y',$wrk) - 2000; $months = date('n',$wrk); $days = date('j',$wrk); Quote Link to comment https://forums.phpfreaks.com/topic/178246-solved-convert-13years-13months-and-31-days-into-14years-2-months-and-1days/#findComment-939816 Share on other sites More sharing options...
PFMaBiSmAd Posted October 19, 2009 Share Posted October 19, 2009 Actually, because each month does not have 31 days, you need a point of reference, either from a specific date or the current date (I was going to post code similar to above, but because it is referenced to January, which has 31 days, the result is not 14 years 2 months 1 day.) Quote Link to comment https://forums.phpfreaks.com/topic/178246-solved-convert-13years-13months-and-31-days-into-14years-2-months-and-1days/#findComment-939826 Share on other sites More sharing options...
surajkandukuri Posted October 19, 2009 Author Share Posted October 19, 2009 Thank you Very much !! problem is solved Quote Link to comment https://forums.phpfreaks.com/topic/178246-solved-convert-13years-13months-and-31-days-into-14years-2-months-and-1days/#findComment-939836 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.