php - From month to month and year -


For example, I have 13 months and I want to convert it to PHP in 1 year and 1 month. 26 - 2 years and 2 months How to "convert" it?

  $ totalmonths = 26; $ Years = floor ($ total month / 12); $ Months = $ total month% 12; Echo every year, "year", $ years == 1? "": "S"; If ($ months! = 0) echo "and", $ months, "month", $ months == 1? "": "S";  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -