If the only input you have is a number of days, as opposed to a start
date and a finish date, it is not possible to convert it in years/months
as the length of the years, as well as the length of the years, vary
over time. Years can range from 365 to 366 days. Months can range from
28 to 31 days.

As a side note, I am not sure this is strictly Go related.

Have a nice day,

Christian.

On 24/01/2020 18:06, Constantine Vassilev wrote:
> I have the following task:
> 
> 1) a number representing days.
> 2) how to convert it to human readable form?
> 
> Like this:
> 11 years 3 months 5 days
> 
> The actual calculations are:
> 
> 4095 days = 136.5 months = 11.375 years
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com
> <mailto:golang-nuts+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/4534a893-73f1-495a-be64-1992a3b4819f%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/4534a893-73f1-495a-be64-1992a3b4819f%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
Christian Mauduit            __/\__  ___
uf...@ufoot.org              \~ ~ / (`_ \   ___
https://ufoot.org            /_o _\    \ \_/ _ \_
int q = (2 * b) || !(2 * b);   \/       \___/ \__)

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6553b5be-8530-f9a3-7a62-901d98de297c%40ufoot.org.

Reply via email to