0

需要帮忙...

我有情景..

注意:我想要一种合乎逻辑的方法来解决并获得夜间时间表的时差。用于考勤监控。

首先,夜间差异时间表(10:00:00PM - 06:00:00AM)其次,我的常规出勤班次时间表是:

[下午 3 点 - 下午 6 点]

[休息时间:6pm - 7pm]

[07PM - 11PM]

由于差异..从晚上 10 点到早上 6 点.. 我晚上 10 点到晚上 11 点的夜班差异总计(1 小时)

有人可以告诉我使用什么代码可以得到 1 小时的答案。

我使用时间跨度和计算时间..但我不知道逻辑或方法。

谢谢你

4

1 回答 1

0
Sub TimeIN_TimeOut()

    Dim timeIn(4), timeOut(4) As DateTime

    Dim days As String() = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
    Dim totalHours, subTotal(4) As Double

    For x As Integer = 0 To 4
        WriteLine()

        Write("Enter Time-In for {0}:", days(x))
        timeIn(x) = ReadLine()

        Write("Enter Time-Out for {0}:", days(x))
        timeOut(x) = ReadLine()


        subTotal(x) += timeOut(x).Subtract(timeIn(x)).TotalHours

        totalHours += subTotal(x)


    Next
    WriteLine()
    WriteLine()
    WriteLine("__________________________________________________")
    WriteLine("Total work Hours from {0} to {1}:{2}", days(0), days(4), totalHours)



End Sub
于 2013-02-21T03:18:38.013 回答