My Name Is Salman Masood , I am Computer Science &Amp; Maths Graduate from University of Karachi, Pakistan , Teaching Is My Passion and My Aim Is to Deliver All My Knowledge among Those Students Who Can'T Afford Tutors or Expensive Institute Fees. I Will Be Keep Sharing My All Knowledge and Information with You .... Remember Me in Your Prayers !
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";
}
Subscribe to:
Post Comments (Atom)
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 ...
-
Load event: pictureBox3.Image = Image .FromFile( @"C:\Users\salman\Documents\Visual Studio 2013\Projects\WindowsFormsApplication3\W...
No comments:
Post a Comment