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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipankar BiswasRank #992 · 2K reputationPosted Sep 7, 2014, 12:54 AM EDT
http://www.codeproject.com/Articles/168662/Time-Period-Library-for-NET
VulpesRank #55 · 29.2K reputationPosted Sep 7, 2014, 9:22 AM EDT
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
Saudie Esmail13 reputationPosted Sep 7, 2014, 5:48 PM EDT
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.. :(
Nitesh KejriwalRank #253 · 9.9K reputationPosted Sep 7, 2014, 7:35 PM EDT
Saudie Esmail13 reputationPosted Sep 9, 2014, 4:14 PM EDT
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 KejriwalRank #253 · 9.9K reputationPosted Sep 9, 2014, 8:37 PM EDT