2008 Oct 31 11:25 AM
Dear All,
I want to calculate the ranges between the time(12 Hrs) on the same date.
Ex:1
Date : 30.10.2008
Time : 09:00:00
Date : 30.10.2008
Time : 06:00:00
Ans: 9 Hrs (Diff Bt Time)
[[ Or.... ]]
Ex:2
No need to given as Date...just time enough for my required...
start Time : 09:00:00
end Time : 06:00:00
Ans : Same as above for EX:1
Please reply immediately....
Regards!!!
Micheal ....
Everything Is Possible...
If We are Working as Unity....
2008 Oct 31 11:30 AM
Hi,
Try like this...
PARAMETERS : tim TYPE tims,
y TYPE tims.
DATA : t TYPE string,
t1 TYPE string,
t2 TYPE string,
t3 TYPE string.
START-OF-SELECTION.
t = tim(2).
t = t . " hours
t1 = tim+2(2).
t1 = t1 / 60 . " minutes to hours
t2 = tim+4(2).
t2 = t2 / 3600. " second to hours
t3 = t + t1 + t2. " total time in hours
" similarly try to convert y to hours.....
t3 = t3 - <y converted to hours>.
Regards
Debarshi
Hi,
Try like this...
PARAMETERS : tim TYPE tims,
y TYPE tims.
DATA : t TYPE string,
t1 TYPE string,
t2 TYPE string,
t3 TYPE string.
START-OF-SELECTION.
t = tim(2).
t = t . " hours
t1 = tim+2(2).
t1 = t1 / 60 . " minutes to hours
t2 = tim+4(2).
t2 = t2 / 3600. " second to hours
t3 = t + t1 + t2. " total time in hours
" similarly try to convert y to hours.....
t3 = t3 - <y converted to hours>.
Regards
Debarshi
2008 Oct 31 11:30 AM
Hi,
Try like this...
PARAMETERS : tim TYPE tims,
y TYPE tims.
DATA : t TYPE string,
t1 TYPE string,
t2 TYPE string,
t3 TYPE string.
START-OF-SELECTION.
t = tim(2).
t = t . " hours
t1 = tim+2(2).
t1 = t1 / 60 . " minutes to hours
t2 = tim+4(2).
t2 = t2 / 3600. " second to hours
t3 = t + t1 + t2. " total time in hours
" similarly try to convert y to hours.....
t3 = t3 - <y converted to hours>.
Regards
Debarshi
2008 Oct 31 11:38 AM
Hi,
For Y Conversion is indicate as TOTAL HOURS or from input Hours...
Plz tell,,,
Thanks & REGARDS!!!
Micheal
2008 Oct 31 11:46 AM
Hi,
I said to calculate smilarly for y....
PARAMETERS : tim TYPE tims,
y TYPE tims.
DATA : t TYPE string,
t1 TYPE string,
t2 TYPE string,
t3 TYPE string,
t4 type string,
t5 type string,
t6 type string,
t7 type string,
t8 type string.
START-OF-SELECTION.
t = tim(2). " hours
t1 = tim+2(2).
t1 = t1 / 60 . " minutes to hours
t2 = tim+4(2).
t2 = t2 / 3600. " second to hours
t3 = t + t1 + t2. " total time in hours
t4 = y(2).
t4 = t . " hours
t5 =y+2(2).
t5 = t5 / 60 . " minutes to hours
t6 =y+4(2).
t6 = t6 / 3600. " second to hours
t7 = t4 + t5 + t6. " total time in hours
t8 = t3 - t7.-----------------> your desired result
Regards
Debarshi
2008 Oct 31 11:30 AM
DATA :
w_d1 TYPE sy-uzeit,
w_d2 TYPE sy-uzeit,
w_result TYPE sy-uzeit.
w_d1 = sy-timlo.
w_d2 = 141005.
w_result = w_d1 - w_d2.
WRITE /:
w_d1,
w_d2,
w_result.
2008 Oct 31 11:55 AM
Hi,
Its coming, But i want to calculate as 12Hrs only ,not as 24 Hrs..Plz reply..
Thanks & Regards!!!
Micheal
2008 Oct 31 12:02 PM
>
>9:00 in the morning
>7:00 in the evening (19:00)
>Just do 7 - 9 = -2. If the result is negative, add 12 to it. Thus the result will be 10.
Did you even try this one out?
2008 Oct 31 11:31 AM
Hi,
Check FM : SD_DATETIME_DIFFERENCE
Thanks & Regards,
Navneeth K.
2008 Oct 31 11:33 AM
Hi,
Try with
SD_DATETIME_DIFFERENCE
TIMECALC_DIFF
Regards,
Suresh
2008 Oct 31 11:42 AM
Hi,
I tried , here taking to calculate as 24 HRS ..
but , i want the 12 Hrs calculation only...
Thanks & Regards!!
Micheal
2008 Oct 31 11:47 AM
Hi,
From ' TIMECALC_DIFF' , this FM have different input format...
.Bcze , its having TIMESTAMP(YYYYMMDDHHMMSS)...i given this format,but it wil not taken as correctly....
Plz tell as the input format
Thanks & Regards!!
Micheal
2008 Oct 31 11:51 AM
With a 12 hour notation i don;t know how the time looks in your variables.
But normally you could do a subtraction of both fields. And even if its in a 12 hour notation, the subtraction works, but you need to adjust the result:
Example:
9:00 in the morning
7:00 in the evening (19:00)
Just do 7 - 9 = -2. If the result is negative, add 12 to it. Thus the result will be 10.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |