calculate year of experience using datepicker C#
  • how to calculate year of experience using datepicker C# winform Application
     
      int Exp = DateTime.Today.Year - DOJDatePicker.Value.Year; // CurrentYear - BirthDate

                ExperiencetxtBox.Text = Exp.ToString();   the output is 3 or 4 

    it give only year but i need 4.5 or 3.5 (float value)


    plz help me how to write it 
    thank you 
  • 2 Comments sorted by
  • Vote Up0Vote Down WaqasWaqas
    172.00 Karma Accepted Answer
    hi you can try this

        double dt = (DateTime.Now.Date - DOJDatePicker.Value.Date).TotalDays;

        ExperiencetxtBox.Text = Math.Round(dt / 365, 2).ToString();
  • thank you waqas its really worth 

Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative