如何获得00:00:00而不是凌晨12:00:00?

时间:2009-09-02 10:42:28

标签: ms-access

使用Access 2003数据库

表1

Intime   Outtime  WorkTime OverTime

08:00:00 19:00:00 09:00:00 02:00:00
09:00:00 18:23:23 09:00:00 00:23:23
15:00:00  -----   00:00:00 00:00:00
09:00:00 18:00:00 09:00:00 00:00:00

银泰,工作时间,工作时间,加班数据类型为文本

From 09:00:00 to 18:00:00 - It will come in Work time
Before 09:00:00, after 18:00:00 – It will come in overtime

我的查询。

SELECT PERSONID,
       CARDEVENTDATE,
       INTIME,
       OUTTIME,
       (IIF(OUTTIME = 'No Punchout', '00:00:00', WorkTime)) AS WorkedTime,
       (IIF(OUTTIME = 'No Punchout', '00:00:00', OverTime)) AS OverdutyTime,
       Latecome,
       (IIF(OUTTIME = 'No Punchout', '', EarlyLeave)) AS EarlyLeave
FROM
       (SELECT PERSONID,
               CARDEVENTDATE,
               INTIME,
               (IIF(OUTTIME = INTIME, 'No PunchOut', OUTTIME)) AS OUTTIME,
               (Format(IIf(CLng(OutTime) > 180000, 
                           CDate('18:00:00'), 
                           CDate(Format(OutTime, '00:00:00'))) 
                       - IIf(CLng(InTime) < 90000, 
                           CDate('09:00:00'), 
                           CDate(Format(InTime, '00:00:00'))),
                       'hh:nn:ss')) AS WorkTime,
               (Format(IIf(CLng(InTime) < 90000, 
                           CDate('09:00:00') 
                           - CDate(Format(InTime, '00:00:00')), 0) 
                       + IIf(CLng(OutTime) > 180000, 
                           CDate(Format(OutTime, '00:00:00')) 
                           - CDate('18:00:00'), 0), 
                       'hh:nn:ss')) AS OverTime,
               (Format(IIf(CLng(Intime) > 090000, 
                           CDate(Format(Intime, '00:00:00'))) 
                       - IIf(90000, CDate('09:00:00'), 
                           CDate(Format(InTime, '00:00:00'))), 
                       'hh:nn:ss')) AS LateCome,
               (Format(IIf(180000, 
                           CDate('18:00:00'), 
                           CDate(Format(outtime, '00:00:00'))) 
                       - IIf(CLng(Outtime) < 180000, 
                           CDate(Format(Outtime, '00:00:00'))), 
                       'hh:nn:ss')) AS EarlyLeave
               (SELECT  T_PERSON.PERSONID,
                        T_CARDEVENT.CARDEVENTDATE,
                        MIN(T_CARDEVENT.CARDEVENTTIME) AS INTIME,
                        MAX(T_CARDEVENT.CARDEVENTTIME) AS OUTTIME
               FROM     T_PERSON
                        INNER JOIN T_CARDEVENT
                        ON       T_PERSON.PERSONID = T_CARDEVENT.PERSONID
               GROUP BY T_PERSON.PERSONID,
                        T_CARDEVENT.CARDEVENTDATE
               )
       )

以上查询是正确在我的系统中工作。

但是当我在客户端系统中使用查询时,它显示如下......

表1

Intime   Outtime  WorkTime    OverTime

08:00:00 19:00:00 09:00:00 AM 02:00:00 AM
09:00:00 18:23:23 09:00:00 AM 12:23:23 AM
15:00:00  -----   12:00:00 AM 00:00:00 AM
09:00:00 18:00:00 09:00:00 AM 12:00:00 AM

显示12:00:00 AM而不是00:00:00,也显示12:23:23而不是00:00:00。

如果是00则显示12:00:00 AM。

使用Access 2007数据库的客户端。没有Access 2003或Access 2007问题。 为什么工作时间和加班时间显示为凌晨12:00:00。我复制了客户端数据库并检查了我的系统中的数据库。工作时间和时间正确显示。

请任何人帮忙解决我的问题。

1 个答案:

答案 0 :(得分:-1)

更改系统显示时间的方式。