且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

24小时格式的出勤管理

更新时间:2023-02-05 15:29:59

只需使用日期和时间而不仅仅是时间。



所以2013年6月3日23:00将永远是例如,不到2013年6月4日00:30。



如果由于某种原因你没有时钟的时钟可用,那么你将不得不决定如何猜测日期应该是什么。例如,如果预计的入住时间是3月23日,并且您有时间刷过09:00,您可以假设这是第4次退房
Simply always use Date&Time rather than just Time.

So 3rd June 2013 23:00 will always be less than 4th June 2013 00:30 for example.

If for some reason you don''t have the date available from the clocking in clock then you will have to make a decision as to how to ''guestimate'' what the date should be. for example if the check in time expected is 23:00 on 3rd and you have a time swiped of 09:00 you could assume this is a check out for the 4th


您有现在的日期&时间,



所以当你过滤或验证日期时间



你可以添加一天到日期时间然后自动你可以得到结果。



ex:



punchdate:03/17/2013 punchtime :10:10pm

nextday punchlogout:03/18/2013 punchtime:1:00AM



验证:



将日期添加到日期时间:



1.您有ShiftBeginDate,ShiftBegintime和ShiftEndtime。



2.要求日期是次日?



解决方案:DateTime ShiftEndTime = ShiftBeginDate.AddDays(1);



3.然后最终条件



var result =来自objpunches中的行

其中( row.ShiftBeginDate& gt; ShiftBegintime)&&(row.ShiftBeginDate< shiftendtime))>

选择行).ToList();



你可以esily得到结果。
you have present date & Time,

So when ever you filter or validate datetime

you can add one day to datetime then automatically you can get the result.

ex:

punchdate:03/17/2013 punchtime:10:10pm
nextday punchlogout:03/18/2013 punchtime:1:00AM

you validation:

add the one day to datetime:

1. you have ShiftBeginDate,ShiftBegintime and ShiftEndtime.

2. required date that is nextday date?

Solution: DateTime ShiftEndTime=ShiftBeginDate.AddDays(1);

3. then finally condition

var result=from row in objpunches
where(row.ShiftBeginDate>ShiftBegintime) && (row.ShiftBeginDate<shiftendtime))>
select row).ToList();

you can esily get the results.