Shourya Verdhan

Shourya Verdhan

  • NA
  • 88
  • 56.3k

How to compare time from current time in C#

Apr 16 2013 2:30 PM
HI,

I am making a payroll software where i want to add a function for attendance where when a employee Login his time will save in Database but if Employee is 20 Mint. Late from their shift time it will automatic create Half Day. I added this code there.

 private void btntimecheck_Click(object sender, EventArgs e)
        {
            if (System.DateTime.Now.Hour >= 10)
            {
                lbltimecheck.Text = "On Time";
            }
            else
            {
                
                    lbltimecheck.Text = "Late";
                
            }
        }


in this code i can  not compare minutes. like 10:20 i can compare only hours.

so please any one know its solution please give me that code.



 





Answers (21)