Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to realize the summation of working time in a fixed period of time by android

Shulou Source: shulou.com Published: 2022-06-01 04:08:01 09月26日 Update

This article mainly introduces android how to achieve the summation of working hours in a fixed period of time, which is very detailed and has a certain reference value. Interested friends must read it!

We have encountered this situation twice recently, which is similar to using the clock-in time to calculate the sum of working hours over a period of time. The table data given is roughly like this.

ID: workshop ID

Gid: device id

ACTIVITY: type, there are two types: in on, out off

Time: the point in time to start or shut down

The requirement now is to enter a start time and an end time to find the working time of each equipment (the same equipment in the same workshop) within this range.

Exception data handling:

1. Duplicate data needs to be deduplicated.

two。

3. A continuous out needs to take the first

4. If the start time of a time period is less than the input start time, it is calculated according to the input start time

5. If the end time of a time period is greater than the input end time, it is calculated according to the input end time

The table input above

The final result is

You can try it.

The data is below:

CREATE TABLE "SYSTEM". "AAREPORT" ("ID" VARCHAR2 (255BYTE), "ACTIVITY" VARCHAR2 (255BYTE), "TXNTIMESTAMP" DATE, "GID" VARCHAR2 (255BYTE) TABLESPACE "SYSTEM" LOGGINGNOCOMPRESSPCTFREE 10INITRANS 1STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) PARALLEL 1NOCACHEDISABLE ROW MOVEMENT

-Records of AAREPORT-- INSERT INTO "SYSTEM". "AAREPORT" VALUES ('1mm,' in', TO_DATE ('2020-07-1508),' SYYYY-MM-DD HH24:MI:SS'),'a') INSERT INTO "SYSTEM". "AAREPORT" VALUES ('1th,' out', TO_DATE ('2020-07-1603 out', TO_DATE,' SYYYY-MM-DD HH24:MI:SS'),'a'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('2percent,' in', TO_DATE ('2020-07-1508),' SYYYY-MM-DD HH24:MI:SS'),'b') INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' in', TO_DATE ('2020-07-15 10 out', TO_DATE),' SYYYY-MM-DD HH24:MI:SS'),'a'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' out', TO_DATE ('2020-07-1602),' SYYYY-MM-DD HH24:MI:SS'),'a') INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' in', TO_DATE ('2020-07-16 10 in', TO_DATE 0000,' SYYYY-MM-DD HH24:MI:SS'),'a'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('44th,' in', TO_DATE ('2020-07-1601) 0000,' SYYYY-MM-DD HH24:MI:SS'),'a') INSERT INTO "SYSTEM". "AAREPORT" VALUES ('44th,' out', TO_DATE ('2020-07-1602out', TO_DATE),' SYYYY-MM-DD HH24:MI:SS'),'a'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('44th,' in', TO_DATE ('2020-07-160900VALUES,' SYYYY-MM-DD HH24:MI:SS'),'a') INSERT INTO "SYSTEM". "AAREPORT" VALUES ('44th,' out', TO_DATE ('2020-07-17 2121 SYYYY-MM-DD HH24:MI:SS'),' a'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('1bn,' in', TO_DATE ('2020-07-1507l07l0700 SYYYY-MM-DD HH24:MI:SS'),' b')) INSERT INTO "SYSTEM". "AAREPORT" VALUES ('1th,' out', TO_DATE ('2020-07-16 04VALUES,' SYYYY-MM-DD HH24:MI:SS'),'b'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' in', TO_DATE ('2020-07-18 1200 SYYYY-MM-DD HH24:MI:SS'),' b')) INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' in', TO_DATE ('2020-07-1708in', TO_DATE),' SYYYY-MM-DD HH24:MI:SS'),'b'); INSERT INTO "SYSTEM". "AAREPORT" VALUES ('3th,' out', TO_DATE ('2020-07-17 1800 SYYYY-MM-DD HH24:MI:SS'),' b')) The above is all the contents of the article "how to achieve the summation of working hours in a fixed period of time by android". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Time input time period work data equipment content article workshop sum value interest partner situation data processing more knowledge type result Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei macOS MySQL Redmi Shulou Information