TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Oladotun Obileye
NA
98
19.3k
How to work with int and datetime in C#
May 26 2019 2:24 AM
Good day everyone please i am working on an application. i want the user to be able to enter the amount of loan they want to borrow, and if the loan is within 1 year it should work. so depending on the months the user is going to borrow the loan. for 6months or lesser the program should multiply the amount entered by the user by 5% within six - nine months 7.5% of the money the user enter e.tc. so if the datatimepicker(days) difference is lesser than 6months(before) but i am getting error
int result;
DateTime reqdt = dtrequest.Value.Date;
DateTime retdt = dtreturn.Value.Date;
DateTime before = reqdt.AddMonths(6);
DateTime within = reqdt.AddMonths(9);
DateTime after = reqdt.AddYears(1);
TimeSpan ts = retdt - reqdt;
int days = ts.Days;
DateTime cde = new DateTime(days);................int days to time
// DateTime cde = Convert.ToDateTime(days);
result = Convert.ToInt32(txtamount.Text);....................converting string to int(error not in the correct format)
if (cde <= before)
{
int mult = result * 5;
txtresult.Text = mult.ToString();
}
Reply
Answers (
2
)
How to count times a data exist in a column in c#
How to pass value from a control to another in C#