Years to Months Conversion

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
 
M

Morten Wennevik

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;
 
R

raghav

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top