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.
VulpesPosted May 28, 2012, 5:24 AM
mithun kumarPosted May 28, 2012, 8:59 AM
Excellent Work,thanks a lot.
Thanks & Regards,
Mithun.
mithun kumarPosted May 28, 2012, 5:45 AM
Excellent Work,thanks a lot.
Thanks & Regards,
Mithun.
mithun kumarPosted May 28, 2012, 4:34 AM
no matter for saturday and sunday...it will be same.
Thanks & Regards,
Mithun.
Kunal VaishyaPosted May 28, 2012, 4:31 AM
working Hrs is Same for all day and what about Saturday and Sunday ?
mithun kumarPosted May 28, 2012, 4:21 AM
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.
EhteshamPosted May 28, 2012, 4:15 AM
dt = dt + new TimeSpan(1, 5, 0, 0);
Kunal VaishyaPosted May 28, 2012, 4:11 AM
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());
}