Jump to content

Calculating number of years


dc_jt

Recommended Posts

Hi

 

Ive got a form which has a "Years" and a "Months" field where a user enters the number of years and months they have been at their residential address. However, the form must have at least 3 years record of their residential history, therefore they can add multiple addresses. What I need to work out is when they get to the 3 years.

 

To do this, would I turn the years into months i.e 1 = 12, 2 = 24 etc and add this to the number of months? Then work out if this total is equal to or greater than 36 (3 years)?

 

Is this the best way to do it or is there a better alternative? Also, how would I represent this in PHP?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/187551-calculating-number-of-years/
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.