{
int totalhours = 8;
int totalmins = 0;
int intimeHour = Convert.ToInt32(textBox1.Text);
int intimemins = Convert.ToInt32(textBox2.Text);
DateTime a = new DateTime(2010, 05, 12, intimeHour, intimemins, 00);
DateTime b = new DateTime(2010, 05, 12, totalhours, totalmins, 00);
double balhours = Convert.ToDouble(b.Subtract(a).TotalMinutes);
TimeSpan t = TimeSpan.FromMinutes(balhours);
string hours = Convert.ToString(t);
int onlyhour = Convert.ToInt32(t.Hours);
int onlymin = Convert.ToInt32(t.Minutes);
label2.Text = "You have to be here for more " + hours + "";
DateTime date = DateTime.Now;
TimeSpan time = new TimeSpan(36, onlyhour, onlymin, 0);
DateTime OfficeExit = date.Add(time);
//TimeSpan exit = OfficeExit.TimeOfDay;
//TimeSpan t2 = new TimeSpan(exit.Ticks - (exit.Ticks % 600000000));
string displayTime = OfficeExit.ToString("hh:mm tt");
label3.Text = "You have to Leave office at :" + displayTime + "";
}
No comments:
Post a Comment