HELP :(
how can I get the vacant time??
for ex.
start = 8:00 AM
end = 9:00 AM
and
9:00 to 12:00 = available..
thanks..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nitesh KejriwalPosted Sep 10, 2014, 12:37 AM
Saudie EsmailPosted Sep 9, 2014, 8:14 PM
like this.
txtFrom.text = 8:00 AM
txtTo.text = 9:00 AM
if i click button
result is txtVacantFrom.text = 9:00 AM & txtVacantTo.text = 12:00 PM
thanks.
Nitesh KejriwalPosted Sep 7, 2014, 11:35 PM
Saudie EsmailPosted Sep 7, 2014, 9:48 PM
like if I have
start time = 8:00 AM
end time = 9:00 AM
and how can get the vacant time??
The possible result should be 9:00 AM to 12:00 PM.
thanks.. :(
VulpesPosted Sep 7, 2014, 1:22 PM
using System;
class Program
{
static void Main()
{
string start = "8:15 AM";
string end = "9:30 AM";
string final = "12:00 PM";
DateTime startTime = DateTime.Parse(start);
DateTime endTime = DateTime.Parse(end);
DateTime finalTime = DateTime.Parse(final);
TimeSpan totalTime = finalTime - startTime;
TimeSpan usedTime = endTime - startTime;
TimeSpan vacantTime = totalTime - usedTime;
Console.WriteLine("Vacant time is {0} hours", vacantTime.TotalHours);
Console.ReadKey();
}
}
The output is:
Vacant time is 3 hours
Dipankar BiswasPosted Sep 7, 2014, 4:54 AM
http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET