View Single Post
Old 13-07-2021, 15:51   #7
lorenzo001
Senior Member
 
Iscritto dal: Jul 2008
Cittā: Roma
Messaggi: 541
Un metodo del genere

Codice:
        int nYears(DateTime start, DateTime end)
        {
            return (end.Year - start.Year - 1) +
                (((end.Month > start.Month) ||
                ((end.Month == start.Month) && (end.Day >= start.Day))) ? 1 : 0);
        }
da chiamare passando le due date

Codice:
 anni = nYears(Data_Nascita, DateTime.Now);
lorenzo001 č offline   Rispondi citando il messaggio o parte di esso