Hello Friends,
Assume now the current Date Time is 27-05-12 15:00
I want to add:-1 days 5 hours 00 min
Or
Suppose your working Hour is 9:00 to 17:00(5'o clock)
1-You got
one task at 27-05-12 15:00 (Date time)
2-And you said I will take 13 hours to complete this task.
3-That's mean today you have 2 Hours(15:00 to 17:00) work and tomorrow 8(9:00
to 17:00) Hours works and day after tomorrow 3(9:00 to 12:00) hours works to
finish 13 hours. So the Output date time to finish this task will be will be as
follows
Output
should be:
29-05-12 12:00
Note: conclusion is that when you will say I will take 780 min or 13 Hours system automatically calculate the finish Date time
Thanks & Regards,
Mithun.

VulpesRank #55 · 29.2K reputationPosted May 28, 2012, 1:24 AM EDT
Kunal VaishyaRank #990 · 2K reputationPosted May 28, 2012, 12:11 AM EDT
try this code it will help you
private void dateAddFucntion()
{
DateTime dt = DateTime.Now;
dt = dt.AddDays(1);
dt = dt.AddHours(5);
dt = dt.AddMinutes (0);
//MessageBox.Show(dt.ToString());
}
EhteshamRank #3,979 · 374 reputationPosted May 28, 2012, 12:15 AM EDT
dt = dt + new TimeSpan(1, 5, 0, 0);
mithun kumar20 reputationPosted May 28, 2012, 12:21 AM EDT
Thanks for your reply.it is adding the Date time.but As i told in my post...i want to add this as per my working hours.i,e the day will finish after 1700 Hrs and next day will start after 9'o clock morning.
Suppose...
1-I got one task at 28-05-12 15:00 (Date time)
2-And I said I will take 13 hours to complete this task.
3-That's mean today I have 2 Hours(15:00 to 17:00) work and tomorrow 8(9:00 to 17:00) Hours works and day after tomorrow 3(9:00 to 12:00) hours works to finish 13 hours. So the Output date time to finish this task will be will be as follows
Output should be:
30-05-12 12:00
Thanks & Regards,
Mithun.
Kunal VaishyaRank #990 · 2K reputationPosted May 28, 2012, 12:31 AM EDT
working Hrs is Same for all day and what about Saturday and Sunday ?
mithun kumar20 reputationPosted May 28, 2012, 12:34 AM EDT
no matter for saturday and sunday...it will be same.
Thanks & Regards,
Mithun.
mithun kumar20 reputationPosted May 28, 2012, 1:45 AM EDT
Excellent Work,thanks a lot.
Thanks & Regards,
Mithun.
mithun kumar20 reputationPosted May 28, 2012, 4:59 AM EDT
Excellent Work,thanks a lot.
Thanks & Regards,
Mithun.