Hi Everyone
Im currently coding a clocking system to monitor hours worked and overtime. I am using C#.Net 2005 and SQL 2005 and i am having a huge issue with the DateTime field.
I want all employees to have a clock in and clock out time, these values are DateTime values however when it saves to the database it includes the date along with the time.
My problem lies in that i use calculations to determine if the employee has worked overtime by using (current time - clock out time), but because it included the date in the database it gives overtime from the day i inserted the employee into the database because it sees this as the clock out.
Is there anyway to extract just the time from the database? Or even make the date the same as the current date (i have tried this but i cannot change the date because it gives me a read only error)
Sorry for the long post. Any help would be greatly appreciated.
And if you need more information just ask and i will give.
Regards Cyril
Im currently coding a clocking system to monitor hours worked and overtime. I am using C#.Net 2005 and SQL 2005 and i am having a huge issue with the DateTime field.
I want all employees to have a clock in and clock out time, these values are DateTime values however when it saves to the database it includes the date along with the time.
My problem lies in that i use calculations to determine if the employee has worked overtime by using (current time - clock out time), but because it included the date in the database it gives overtime from the day i inserted the employee into the database because it sees this as the clock out.
Is there anyway to extract just the time from the database? Or even make the date the same as the current date (i have tried this but i cannot change the date because it gives me a read only error)
Sorry for the long post. Any help would be greatly appreciated.
And if you need more information just ask and i will give.
Regards Cyril
Comment