Sunday 10 June 2018

How to calculate age from date of birth in c# windows application





 private void button2_Click(object sender, EventArgs e)

        {

            DateTime fdate = new DateTime(2000, 6, 1);

            DateTime sdate = new DateTime(2018, 6, 11);

            string diff = (sdate - fdate).TotalDays.ToString();

            int totaldays = Convert.ToInt32(diff);

            int year = totaldays / 365;

            int remainingdays = totaldays % 365;

            int month = Convert.ToInt32(remainingdays / 30.41);

            remainingdays = remainingdays % 30;

            label1.Text = year + " years , " + month + " months and " + remainingdays + " days";













        }

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...