Hello sir i want to calculate no oh houres like per day 4 houre and implement on calculattor like i will entre total no of houre is 44 and i will chose date 01/01/2017 then calculate end date is 11/01/2014 on calender how can do that plz help me....
protected void txt_startDate_TextChanged(object sender, EventArgs e)
{
String dateInString = txtnohr.Text;
DateTime r, r1;
string s = "", s1 = "";
DateTime startDate = DateTime.Parse(txt_startDate.Text);
int totalnoofhr, oneday = 4;
totalnoofhr = Convert.ToInt32(dateInString);
int count = 0;
for (int j = 0; j <= totalnoofhr; j++)
{
if (totalnoofhr != 0)
{
if (count == j)
{
s = startDate.AddDays(j).ToShortDateString();
totalnoofhr = totalnoofhr - oneday;
count = count + 1;
}
}
}
s1 = s;
lbl_show.Text = s1;
r1 = Convert.ToDateTime(s1);
s1 = r1.AddDays(1).ToShortDateString();
String myString = s1; // get value from text field
r = Convert.ToDateTime(myString);
String myString_new = r.ToString("yyyy-MM-dd"); // add myString_new to oracle
lbl_show.Text = myString_new;
}

Ankit SharmaRank #141 · 16.1K reputationPosted Sep 18, 2017, 12:26 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Sep 2, 2017, 5:33 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 4, 2017, 12:14 AM EDT
As per my understanding of your question, you want to add hours in input date and find the output date, where total number of hours in one day is 4.
You can use following code
Sanjana Khalasi57 reputationPosted Sep 14, 2017, 1:29 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 14, 2017, 1:48 AM EDT
Sanjana Khalasi57 reputationPosted Sep 14, 2017, 2:03 AM EDT
Sanjana Khalasi57 reputationPosted Sep 14, 2017, 2:38 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 14, 2017, 2:45 AM EDT
Sanjana Khalasi57 reputationPosted Sep 14, 2017, 3:03 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 14, 2017, 3:13 AM EDT
Sanjana Khalasi57 reputationPosted Sep 17, 2017, 11:29 PM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 17, 2017, 11:55 PM EDT
Sanjana Khalasi57 reputationPosted Sep 18, 2017, 12:06 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 18, 2017, 12:11 AM EDT
Sanjana Khalasi57 reputationPosted Sep 18, 2017, 12:14 AM EDT
Sanjana Khalasi57 reputationPosted Sep 18, 2017, 12:45 AM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Sep 18, 2017, 12:46 AM EDT
Sanjana Khalasi57 reputationPosted Oct 11, 2017, 11:40 PM EDT