473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Years to Months Conversion

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

Sep 22 '06 #1
2 1778
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;

On Fri, 22 Sep 2006 10:54:42 +0200, raghav <ma********@gmail.comwrote:
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


--
Happy Coding!
Morten Wennevik [C# MVP]
Sep 22 '06 #2
Hi Morten
Thanks for ur kind help.
--Raghav

Morten Wennevik wrote:
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;

On Fri, 22 Sep 2006 10:54:42 +0200, raghav <ma********@gmail.comwrote:
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

--
Happy Coding!
Morten Wennevik [C# MVP]
Sep 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bambero | last post by:
Hello all Problem like in subject. There is no problem when I want to count days between two dates. Problem is when I want to count years becouse of leap years. For ex. between 2002-11-19...
1
by: B W Dudley | last post by:
Trying to have a column in a report show the difference between two dates. E.G. One column has "date joined" and new column is to show difference from "join date" and today; preferably in years and...
4
by: Mr C | last post by:
Hi If i have a field in a database start date and end date, how am I able to find out which financial years the two dates cover, and populate colunms in a database with how many months in each...
6
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date Obtained and Date Of Expiry I want a further 3 columns...
5
by: Juan | last post by:
Hi everyone, is there a function that calculates the exact amount of Years, Months, and Days between two days? TimeDiff is not good enough, since it calculates, for example: Date 1: Dec....
37
by: Gregc. | last post by:
G'day I'm trying to work out the number of years since 1970, here is my code: include <stdio.h> #include <time.h> const int SEC_IN_MIN = 60; const int SEC_IN_HOUR = SEC_IN_MIN * 60;
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
4
by: MCLR | last post by:
Good day to all: I found your website a couple of days ago as I was searching for resources that can help within my particular problem in writing a script for an Access Query. The issue is to...
2
by: ichew | last post by:
I have two dates - Date Joined and Actual Last Day. How do I find the YIS in for format of Years and Month from these two dates. Eg, Date Joined: 28/06/1971 and Actual Last Day: 24/01/2007, then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.