‎2007 Feb 17 1:45 PM
Could someone explain me the following from the code below:-
q1]] How do we get "72000 and 7200 " ?
q2]] How do we get "-64800"?
q3]] what is the possible answer ? Is not it that from say 2 ' o clock morning to 8 ' clock evening i,e., we get 18 hours----
then why is this logic required??
code:-
Example of a time calculation:
DATA: DIFF TYPE I,
SECONDS TYPE I,
HOURS TYPE I.
DATA: T1 TYPE T VALUE '200000',
T2 TYPE T VALUE '020000'.
DIFF = T2 - T1.
SECONDS = DIFF MOD 86400.
HOURS = SECONDS / 3600.
The number of hours between 02:00:00 and 20:00:00 is calculated.
1. First, the difference between the time fields is calculated. This is -64800, since T1
and T2 are converted internally into 72000 and 7200 respectively.
2. Second, with the operation MOD, this negative difference is converted to the total
number of seconds. A positive difference would be unaffected by this calculation.
3. Third, the number of hours is calculated by dividing the number of seconds by 3600.
The last three lines can be replaced by the following line
HOURS = ( ( T2 - T1 ) MOD 86400 ) / 3600
‎2007 Feb 17 2:43 PM
hi,
it seems mathematical calculations needed for ur query.
1) 20 hrs is converted internally to seconds that is 20 * 60 * 60 = 72000 sec.
2 hrs is converted internally to seconds that is 2 * 60 * 60 =7200 sec.
2) As per ur program u have mentioned as 2 hrs - 20 hrs.
I put it in a correct form, 7200 - 72000 which gives u -64800 sec.
Regards...
Arun.
Reward points if helpful.
‎2007 Feb 17 2:43 PM
hi,
it seems mathematical calculations needed for ur query.
1) 20 hrs is converted internally to seconds that is 20 * 60 * 60 = 72000 sec.
2 hrs is converted internally to seconds that is 2 * 60 * 60 =7200 sec.
2) As per ur program u have mentioned as 2 hrs - 20 hrs.
I put it in a correct form, 7200 - 72000 which gives u -64800 sec.
Regards...
Arun.
Reward points if helpful.