Years to Months Conversion

  • Thread starter Thread starter raghav
  • Start date Start date
R

raghav

Hi
I am working on ASP.NET 2.0 and C#. I am developing one application in
which I have one field as Work Experience. For that I have 2 dropdown
menus, one for year and other one for month. I want to convert overall
work experience in total number of months. I have single column in DB
as work experience. I have idea that what i am supposed to do but dont
know how exactly to implement.
suppose i am choosing Year=2 and Months=6
then it will be
2*12+6=30 months. so 30 value i have to send to DB.
Please assist me to do so....
Regards
Raghav Mahajan
 
Hi,

You seem to have the logic in place. What exactly do you have trouble
with?

Using two DropDownList you can easily determine the total months using
your formula.

int year = Int32.Parse(DropDownList1.SelectedItem.Text);
int month = Int32.Parse(DropDownList2.SelectedItem.Text);
int totalmonths = year * 12 + month;
 
Hi Morten
Thanks for ur kind help.
--Raghav



Morten said:
Hi,

You seem to have the logic in place. What exactly do you have trouble
with?

Using two DropDownList you can easily determine the total months using
your formula.

int year = Int32.Parse(DropDownList1.SelectedItem.Text);
int month = Int32.Parse(DropDownList2.SelectedItem.Text);
int totalmonths = year * 12 + month;
 
Back
Top